|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sibvisions.rad.server.security.AbstractSecurityManager
com.sibvisions.rad.server.security.DBSecurityManager
public class DBSecurityManager
The DBSecurityManager
uses a database to validate/authenticate users.
It requires the following information to establish a database connection:
IConnectionConstants.PREFIX_CLIENT + "login.auto"
should be set to true
when the user logs on.
After a successful logon the property: IConnectionConstants.PREFIX_CLIENT + "login.key"
will be set to
a unique login key. The client should store the key in its local registry. When the property
IConnectionConstants.PREFIX_CLIENT + "login.key"
is set before opening the connection, then the user will be logged in
if the login is possible!
Nested Class Summary | |
---|---|
static class |
DBSecurityManager.DBAccessController
The DBAccessController controls the access to server side objects based on the
configuration in the database. |
Field Summary | |
---|---|
protected static String |
TABLE_AUTOLOGIN
the name of the autologin table. |
protected static String |
TABLE_USERS
the name of the users table. |
protected static String |
VIEW_ACCESSRULES
the name of the accessrules table. |
Constructor Summary | |
---|---|
DBSecurityManager()
|
Method Summary | |
---|---|
void |
changePassword(ISession pSession)
Changes the password for a user. |
protected void |
closeConnection()
Close all statements and the connection. |
protected IAccessController |
createAccessController(ISession pSession)
Creates an access controller for a ISession . |
protected void |
finalize()
|
IAccessController |
getAccessController(ISession pSession)
Gets the access controller for a session. |
Connection |
getConnection()
Gets the current connection to the database. |
Connection |
getConnection(ISession pSession)
Gets the connection to the database. |
static DBCredentials |
getCredentials(IConfiguration pConfig)
Gets the configured database credentials from a given configuration. |
protected DBCredentials |
getCredentials(ISession pSession)
Gets the configured database credentials for the given session. |
protected void |
initStatements(Connection pConnection)
Initializes all prepared statements with current table and column names. |
protected boolean |
isActive(ISession pSession,
String pActive)
Checks if a user is active. |
protected boolean |
isChangePassword(ISession pSession,
String pChangePassword)
Checks if the change password flag is set. |
protected boolean |
isPasswordValid(ISession pSession,
String pPassword)
Checks if the user password is valid. |
protected boolean |
isValid(ISession pSession,
Timestamp pFrom,
Timestamp pTo)
Checks if a user is valid. |
void |
logout(ISession pSession)
Performs a manual or automatic logout. |
protected Connection |
openConnection(ISession pSession)
Opens a database connection to the database of an application. |
void |
release()
Releases all used resources. |
void |
validateAuthentication(ISession pSession)
Validates if a session has valid credentials to access an application. |
Methods inherited from class com.sibvisions.rad.server.security.AbstractSecurityManager |
---|
addHiddenPackage, checkPassword, comparePassword, createSecurityManager, createSecurityManager, getEncryptedPassword, getPasswordValidator, isHiddenPackage, isPasswordEncryptionEnabled, prepareException, prepareException, removeHiddenPackage, validatePassword |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String TABLE_USERS
protected static final String TABLE_AUTOLOGIN
protected static final String VIEW_ACCESSRULES
Constructor Detail |
---|
public DBSecurityManager()
Method Detail |
---|
public void validateAuthentication(ISession pSession) throws Exception
pSession
- the session which needs access
Exception
- if the access is denied (invalid username or password, password needs to be changed, ...)public void changePassword(ISession pSession) throws Exception
pSession
- the session which wants to change the password
Exception
- if it's not possible to change the passwordpublic void logout(ISession pSession)
pSession
- the session which performs the logoutpublic IAccessController getAccessController(ISession pSession) throws Exception
pSession
- the session for which the access controller is needed
null
if no access controller should be used
Exception
- if the access controller could not be createdpublic void release()
protected void finalize() throws Throwable
finalize
in class Object
Throwable
protected Connection openConnection(ISession pSession) throws Exception
pSession
- the session for which the connection should be opened
Exception
- if the application zone is invalid or the connection can not be opened
IllegalArgumentException
- if the database configuration is invalid (parameters are missing, ...)protected void closeConnection() throws Exception
Exception
- if one statement can not be closedprotected void initStatements(Connection pConnection) throws Exception
pConnection
- the connection to use
Exception
- if an exception occurs during statement creationprotected boolean isActive(ISession pSession, String pActive) throws Exception
pSession
- the session which needs accesspActive
- the active flag or null
if the flag is not available
true
if the active flag is missing or the flag equals the yes value
Exception
- if the configuration of the session is invalidprotected boolean isValid(ISession pSession, Timestamp pFrom, Timestamp pTo)
pSession
- the session which needs accesspFrom
- the from date/time or null
for undefinedpTo
- the to date/time or null
for undefined
true
if the from/to combination is possible, false
otherwiseprotected boolean isPasswordValid(ISession pSession, String pPassword) throws Exception
pSession
- the session which needs accesspPassword
- the confirmation password (encrypted or plain text)
true
if the user password is valid
Exception
- if the password validation failed (e.g. encryption problems)protected boolean isChangePassword(ISession pSession, String pChangePassword) throws Exception
pSession
- the session which needs accesspChangePassword
- the change password flag or null
if the flag is not available
true
if the change password flag is set or false
if the flag is
null
or is not set
Exception
- if the configuration of the session is invalidprotected IAccessController createAccessController(ISession pSession)
ISession
.
pSession
- the session which requests the access controller
protected DBCredentials getCredentials(ISession pSession)
pSession
- the session
getCredentials(IConfiguration)
public static DBCredentials getCredentials(IConfiguration pConfig)
pConfig
- the configuration
public Connection getConnection() throws Exception
null
if the security manager did
not open a connection
Exception
- if db access failspublic Connection getConnection(ISession pSession) throws Exception
pSession
- the session that wants access to the database
Exception
- if db access fails
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |