|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sibvisions.rad.server.security.AbstractSecurityManager
public abstract class AbstractSecurityManager
The AbstractSecurityManager
is the base class for ISecurityManager
implementations
but it does not implement the security methods.
It supports security managers with important and usable methods.
Constructor Summary | |
---|---|
AbstractSecurityManager()
|
Method Summary | |
---|---|
static void |
addHiddenPackage(java.lang.String pPackage)
Adds a package name to the hidden package list. |
void |
checkPassword(ISession pSession,
java.lang.String pPassword)
Checks if a password is strength enough to be used. |
protected boolean |
comparePassword(IConfiguration pConfig,
java.lang.String pPassword,
java.lang.String pConfirmPassword)
Compares two passwords to be identical. |
static ISecurityManager |
createSecurityManager(java.lang.ClassLoader pLoader,
ISession pSession)
Creates a new ISecurityManager for the given session and class loader. |
static ISecurityManager |
createSecurityManager(ISession pSession)
Creates a new ISecurityManager for the given session. |
static ISecurityManager |
createSecurityManager(java.lang.String pApplicationName)
Creates a new ISecurityManager for the given application. |
void |
debug(java.lang.Object... pInfo)
Logs debug information. |
void |
error(java.lang.Object... pInfo)
Logs error information. |
static java.lang.String |
getEncryptedPassword(IConfiguration pConfig,
java.lang.String pPassword)
Gets the password, encrypted with the algorithm specified in an application configuration. |
protected IPasswordValidator |
getPasswordValidator(IConfiguration pConfig)
Gets the password validator from an application configuration. |
void |
info(java.lang.Object... pInfo)
Logs information. |
boolean |
isAllowEncryptedUserPassword()
Gets whether encrypted user passwords should be allowed. |
static boolean |
isHiddenPackage(java.lang.String pJavaName)
Checks if a class or package name is excluded through the hidden package list. |
protected boolean |
isPasswordEncrypted(java.lang.String pPassword)
Gets whether the given password is already encrypted. |
static boolean |
isPasswordEncryptionEnabled(IConfiguration pConfig)
Checks if the password encryption is enabled. |
static java.lang.Throwable |
prepareException(java.lang.Throwable pException)
Hides the StackTraceElements of "com.sibvisions.rad.*" when the given exception is a SecurityException . |
static java.lang.Throwable |
prepareException(java.lang.Throwable pException,
boolean pForce)
Hides the StackTraceElements of "com.sibvisions.rad.*" when the given exception is a SecurityException . |
static void |
removeHiddenPackage(java.lang.String pPackage)
Removes a package name from the hidden package list. |
void |
setAllowEncryptedUserPassword(boolean pAllow)
Sets whether encrypted user passwords should be allowed. |
protected void |
validatePassword(ISession pSession,
java.lang.String pOldPassword,
java.lang.String pNewPassword)
Validates a new password against an old password an uses a preconfigured password validator for checking the strength of the new password. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.sibvisions.rad.server.security.ISecurityManager |
---|
changePassword, getAccessController, logout, release, validateAuthentication |
Constructor Detail |
---|
public AbstractSecurityManager()
Method Detail |
---|
public void checkPassword(ISession pSession, java.lang.String pPassword)
checkPassword
in interface IPasswordValidator
pSession
- the session which wants to change the passwordpPassword
- the new passwordprotected boolean comparePassword(IConfiguration pConfig, java.lang.String pPassword, java.lang.String pConfirmPassword) throws java.lang.Exception
pConfig
- the application configurationpPassword
- base password (plain text)pConfirmPassword
- confirmation password (encrypted or plain text)
true
if the passwords are identical, otherwise false
java.lang.Exception
- if the password encryption causes an errorprotected IPasswordValidator getPasswordValidator(IConfiguration pConfig)
pConfig
- the application configuration
IPasswordValidator
or null
if no validator is specifiedprotected void validatePassword(ISession pSession, java.lang.String pOldPassword, java.lang.String pNewPassword) throws java.lang.Exception
pSession
- the session which changes the passwordpOldPassword
- the old/current passwordpNewPassword
- the new password
java.lang.Exception
- if the password validation failed, e.g. old = new, new is not strength enough, ...public static java.lang.String getEncryptedPassword(IConfiguration pConfig, java.lang.String pPassword) throws java.lang.Exception
pConfig
- the application configurationpPassword
- the plain text password
java.lang.Exception
- if the encryption failspublic static boolean isPasswordEncryptionEnabled(IConfiguration pConfig)
/application/securitymanager/passwordalgorithm
contains an algorithm.
PLAIN is not interpreted as algorithm.
pConfig
- the application configuration
true
if the password should be encryptedpublic static ISecurityManager createSecurityManager(ISession pSession) throws java.lang.Exception
ISecurityManager
for the given session.
pSession
- the session
java.lang.Exception
- if the security manager is not set, the class was not found or the application is invalidpublic static ISecurityManager createSecurityManager(java.lang.ClassLoader pLoader, ISession pSession) throws java.lang.Exception
ISecurityManager
for the given session and class loader.
pLoader
- the class loader to usepSession
- the session
java.lang.Exception
- if the security manager is not set, the class was not found or the application is invalidpublic static ISecurityManager createSecurityManager(java.lang.String pApplicationName) throws java.lang.Exception
ISecurityManager
for the given application.
pApplicationName
- the name of the application
java.lang.Exception
- if the security manager is not set, the class was not found or the application is invalidpublic static java.lang.Throwable prepareException(java.lang.Throwable pException)
SecurityException
. If ILogger.LogLevel.DEBUG
is enabled, the stack won't be
changed.
pException
- the occured exception
public static java.lang.Throwable prepareException(java.lang.Throwable pException, boolean pForce)
SecurityException
. If ILogger.LogLevel.DEBUG
is enabled, the stack won't be
changed, but it's possible to force changing.
pException
- the occured exceptionpForce
- force exception hiding
public static void addHiddenPackage(java.lang.String pPackage)
pPackage
- the full qualified java package name e.g. com.sibvisionspublic static void removeHiddenPackage(java.lang.String pPackage)
pPackage
- the full qualified java package naem e.g. com.sibvisionspublic static boolean isHiddenPackage(java.lang.String pJavaName)
pJavaName
- the full qualified java class or package name e.g. com.sibvisions.rad.IPackageSetup
true
if the name contains a hidden package nameprotected boolean isPasswordEncrypted(java.lang.String pPassword)
pPassword
- the password to check
true
if the given password is already protected, false
otherwisepublic void setAllowEncryptedUserPassword(boolean pAllow)
pAllow
- true
to allow encrypted user passwords, false
to disable
encrypted user passwords (recommended)public boolean isAllowEncryptedUserPassword()
true
if encrypted user passwords are allowed, false
otherwisesetAllowEncryptedUserPassword(boolean)
public void debug(java.lang.Object... pInfo)
pInfo
- the debug informationpublic void info(java.lang.Object... pInfo)
pInfo
- the informationpublic void error(java.lang.Object... pInfo)
pInfo
- the error information
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |