|
||||||||||
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.AbstractDBSecurityManager
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!
Field Summary | |
---|---|
protected static java.lang.String |
TABLE_AUTOLOGIN
the name of the autologin table. |
protected static java.lang.String |
TABLE_USERS
the name of the users table. |
protected static java.lang.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 |
closeStatements()
Close all registered statements. |
IAccessController |
getAccessController(ISession pSession)
Gets the access controller for a session. |
protected java.lang.String |
getAliveQuery()
Gets the query which should be use for connection check. |
static java.lang.String |
getSimpleEnvironmentName(ISession pSession)
Gets the name of the environment from the given session, without additional information. |
protected void |
initStatements(java.sql.Connection pConnection)
Initializes all statements after opening a database connection. |
protected boolean |
isActive(ISession pSession,
java.lang.String pActive)
Checks if a user is active. |
protected boolean |
isChangePassword(ISession pSession,
java.lang.String pChangePassword)
Checks if the change password flag is set. |
protected boolean |
isPasswordValid(ISession pSession,
java.lang.String pPassword)
Checks if the user password is valid. |
protected boolean |
isValid(ISession pSession,
java.sql.Timestamp pFrom,
java.sql.Timestamp pTo)
Checks if a user is valid. |
void |
logout(ISession pSession)
Performs a manual or automatic logout. |
protected void |
postAuthentication(ISession pSession,
java.math.BigDecimal pUserId)
Allows additional checks after user was validated. |
protected void |
preAuthentication(ISession pSession)
Allows additional checks before user will be validated. |
protected void |
updateConfiguration(IConfiguration pConfig)
Updates relevant information after configuration was changed. |
void |
validateAuthentication(ISession pSession)
Validates if a session has valid credentials to access an application. |
Methods inherited from class com.sibvisions.rad.server.security.AbstractDBSecurityManager |
---|
close, closeConnection, createAccessController, finalize, getConnection, getConnection, getCredentials, getCredentials, isConnectionAlive, openConnection, prepareCall, prepareStatement, register, release, unregister |
Methods inherited from class com.sibvisions.rad.server.security.AbstractSecurityManager |
---|
addHiddenPackage, checkPassword, comparePassword, createSecurityManager, createSecurityManager, createSecurityManager, debug, error, getEncryptedPassword, getPasswordValidator, info, isAllowEncryptedUserPassword, isHiddenPackage, isPasswordEncrypted, isPasswordEncryptionEnabled, prepareException, prepareException, removeHiddenPackage, setAllowEncryptedUserPassword, validatePassword |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String TABLE_USERS
protected static final java.lang.String TABLE_AUTOLOGIN
protected static final java.lang.String VIEW_ACCESSRULES
Constructor Detail |
---|
public DBSecurityManager()
Method Detail |
---|
public void validateAuthentication(ISession pSession) throws java.lang.Exception
pSession
- the session which needs access
java.lang.Exception
- if the access is denied (invalid username or password, password needs to be changed, ...)public void changePassword(ISession pSession) throws java.lang.Exception
pSession
- the session which wants to change the password
java.lang.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 java.lang.Exception
pSession
- the session for which the access controller is needed
null
if no access controller should be used
java.lang.Exception
- if the access controller could not be createdprotected void updateConfiguration(IConfiguration pConfig) throws java.lang.Exception
updateConfiguration
in class AbstractDBSecurityManager
pConfig
- the session configuration
java.lang.Exception
- if an exception occurs during statement creationprotected void closeStatements()
closeStatements
in class AbstractDBSecurityManager
protected void initStatements(java.sql.Connection pConnection) throws java.lang.Exception
initStatements
in class AbstractDBSecurityManager
pConnection
- the connection to use
java.lang.Exception
- if an exception occurs during statement creationprotected java.lang.String getAliveQuery()
select 1 from dual
is enough.
getAliveQuery
in class AbstractDBSecurityManager
protected boolean isActive(ISession pSession, java.lang.String pActive) throws java.lang.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
java.lang.Exception
- if the configuration of the session is invalidprotected boolean isValid(ISession pSession, java.sql.Timestamp pFrom, java.sql.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, java.lang.String pPassword) throws java.lang.Exception
pSession
- the session which needs accesspPassword
- the confirmation password (encrypted or plain text)
true
if the user password is valid
java.lang.Exception
- if the password validation failed (e.g. encryption problems)protected boolean isChangePassword(ISession pSession, java.lang.String pChangePassword) throws java.lang.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
java.lang.Exception
- if the configuration of the session is invalidprotected void preAuthentication(ISession pSession) throws java.lang.Exception
pSession
- the session
java.lang.Exception
- if a pre authentication error occurs
java.lang.SecurityException
- if authentication should failprotected void postAuthentication(ISession pSession, java.math.BigDecimal pUserId) throws java.lang.Exception
pSession
- the sessionpUserId
- the user id
java.lang.Exception
- if a post authentication error occurs
java.lang.SecurityException
- if authentication should failpublic static java.lang.String getSimpleEnvironmentName(ISession pSession)
pSession
- the session
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |