Top Description Inners Fields Constructors Methods
org.eclipse.jetty.plus.security

public Class DataSourceLoginService

extends AbstractLoginService
Class Inheritance
Imports
java.sql.Connection, .DatabaseMetaData, .PreparedStatement, .ResultSet, .SQLException, .Statement, java.util.ArrayList, .List, .Locale, java.util.stream.Collectors, javax.naming.InitialContext, .NameNotFoundException, .NamingException, javax.sql.DataSource, org.eclipse.jetty.plus.jndi.NamingEntryUtil, org.eclipse.jetty.security.AbstractLoginService, .IdentityService, .RolePrincipal, .UserPrincipal, org.eclipse.jetty.server.Server, org.eclipse.jetty.util.security.Credential, org.slf4j.Logger, .LoggerFactory

DataSourceLoginService

Obtain user/password/role information from a database via jndi DataSource.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private boolean
private DataSource
private String
private String
private String
private String
private String
private Server
private String
private String
private String
private String
private String
private String
private String
private String
private static final Logger
Inherited from org.eclipse.jetty.security.AbstractLoginService:
_fullValidate_identityService_name

Constructor Summary

AccessConstructor and Description
public
public
public

Method Summary

Modifier and TypeMethod and Description
private Connection
public boolean
public String
public String
public String
public String
public Server
public String
public String
public String
public String
public String
public String
public String
public void
initDb()

Lookup the datasource for the jndiName and formulate the necessary sql query strings based on the configured table and column names.

public List<RolePrincipal>
public UserPrincipal
private void
public void
setCreateTables(boolean createTables)

public void
public void
public void
public void
setRoleTableRoleField(String tableRoleField)

public void
setServer(Server server)

public void
public void
setUserRoleTableRoleKey(String roleTableRoleKey)

public void
setUserRoleTableUserKey(String roleTableUserKey)

public void
public void
public void
setUserTablePasswordField(String tablePasswordField)

public void
setUserTableUserField(String tableUserField)

Inherited from org.eclipse.jetty.security.AbstractLoginService:
getIdentityServicegetNameisFullValidateloginlogoutsetFullValidatesetIdentityServicesetNametoStringvalidate

Field Detail

_createTablesback to summary
private boolean _createTables
_datasourceback to summary
private DataSource _datasource
_jndiNameback to summary
private String _jndiName
_roleSqlback to summary
private String _roleSql
_roleTableKeyback to summary
private String _roleTableKey
_roleTableNameback to summary
private String _roleTableName
_roleTableRoleFieldback to summary
private String _roleTableRoleField
_serverback to summary
private Server _server
_userRoleTableNameback to summary
private String _userRoleTableName
_userRoleTableRoleKeyback to summary
private String _userRoleTableRoleKey
_userRoleTableUserKeyback to summary
private String _userRoleTableUserKey
_userSqlback to summary
private String _userSql
_userTableKeyback to summary
private String _userTableKey
_userTableNameback to summary
private String _userTableName
_userTablePasswordFieldback to summary
private String _userTablePasswordField
_userTableUserFieldback to summary
private String _userTableUserField
LOGback to summary
private static final Logger LOG

Hides org.eclipse.jetty.util.component.ContainerLifeCycle.LOG.

Constructor Detail

DataSourceLoginServiceback to summary
public DataSourceLoginService()
DataSourceLoginServiceback to summary
public DataSourceLoginService(String name)
DataSourceLoginServiceback to summary
public DataSourceLoginService(String name, IdentityService identityService)

Method Detail

getConnectionback to summary
private Connection getConnection() throws NamingException, SQLException
getCreateTablesback to summary
public boolean getCreateTables()
getJndiNameback to summary
public String getJndiName()
getRoleTableKeyback to summary
public String getRoleTableKey()
getRoleTableNameback to summary
public String getRoleTableName()
getRoleTableRoleFieldback to summary
public String getRoleTableRoleField()
getServerback to summary
public Server getServer()
getUserRoleTableNameback to summary
public String getUserRoleTableName()
getUserRoleTableRoleKeyback to summary
public String getUserRoleTableRoleKey()
getUserRoleTableUserKeyback to summary
public String getUserRoleTableUserKey()
getUserTableKeyback to summary
public String getUserTableKey()
getUserTableNameback to summary
public String getUserTableName()
getUserTablePasswordFieldback to summary
public String getUserTablePasswordField()
getUserTableUserFieldback to summary
public String getUserTableUserField()
initDbback to summary
public void initDb() throws NamingException, SQLException

Lookup the datasource for the jndiName and formulate the necessary sql query strings based on the configured table and column names.

Exceptions
NamingException:
if unable to init jndi
SQLException:
if unable to init database
loadRoleInfoback to summary
public List<RolePrincipal> loadRoleInfo(UserPrincipal user)

Implements abstract org.eclipse.jetty.security.AbstractLoginService.loadRoleInfo.

Annotations
@Override
loadUserInfoback to summary
public UserPrincipal loadUserInfo(String username)

Implements abstract org.eclipse.jetty.security.AbstractLoginService.loadUserInfo.

Annotations
@Override
prepareTablesback to summary
private void prepareTables() throws NamingException, SQLException
setCreateTablesback to summary
public void setCreateTables(boolean createTables)
setJndiNameback to summary
public void setJndiName(String jndi)
setRoleTableKeyback to summary
public void setRoleTableKey(String tableKey)
setRoleTableNameback to summary
public void setRoleTableName(String tableName)
setRoleTableRoleFieldback to summary
public void setRoleTableRoleField(String tableRoleField)
setServerback to summary
public void setServer(Server server)
setUserRoleTableNameback to summary
public void setUserRoleTableName(String roleTableName)
setUserRoleTableRoleKeyback to summary
public void setUserRoleTableRoleKey(String roleTableRoleKey)
setUserRoleTableUserKeyback to summary
public void setUserRoleTableUserKey(String roleTableUserKey)
setUserTableKeyback to summary
public void setUserTableKey(String tableKey)
setUserTableNameback to summary
public void setUserTableName(String name)
setUserTablePasswordFieldback to summary
public void setUserTablePasswordField(String tablePasswordField)
setUserTableUserFieldback to summary
public void setUserTableUserField(String tableUserField)
org.eclipse.jetty.plus.security back to summary

public Class DataSourceLoginService.DBUserPrincipal

extends UserPrincipal
Class Inheritance

DBUser

Field Summary

Modifier and TypeField and Description
private int
Inherited from org.eclipse.jetty.security.UserPrincipal:
_credential

Constructor Summary

AccessConstructor and Description
public
DBUserPrincipal(String name, Credential credential, int key)

Method Summary

Modifier and TypeMethod and Description
public int
Inherited from org.eclipse.jetty.security.UserPrincipal:
authenticateauthenticateauthenticateconfigureSubjectdeconfigureSubjectgetNametoString

Field Detail

_keyback to summary
private int _key

Constructor Detail

DBUserPrincipalback to summary
public DBUserPrincipal(String name, Credential credential, int key)

Method Detail

getKeyback to summary
public int getKey()