|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface SimpleLogin
This class provides a helper service for making an easy login and logout operations. The base algorithm for logging in any user is:
Authorization
object with parameter the name of the group that represents wanted rights for
access.
Authorization.logout() to avoid any
farther undesired check for such user.
mbs.useradmin.anonymousConnect which, if set to
true will allow anonymous login, if the UserAdmin
service is not available.
| Field Summary | |
|---|---|
static java.lang.String |
PASSWORD
This keys stores the password credentials of the user in the authorization properties. |
static java.lang.String |
SHA1_HASH
This keys stores a SHA1 hash of the password credentials. |
static java.lang.String |
USERNAME
This keys stores the name of the user in the authorization properties. |
| Method Summary | |
|---|---|
Authorization |
getAuthorization(java.lang.Object context)
Retrieves the Authorization object that is associated with the
specified context. |
Authorization |
login(java.lang.String username,
java.lang.String password)
This method is similar to calling: SimpleLogin.login(username, SimpleLogin.PASSWORD, password); |
Authorization |
login(java.lang.String username,
java.lang.String algorithm,
java.lang.Object credential)
This method tries to authorize the user defined by it's name, password algorithm and credentials. |
Authorization |
setAuthorization(java.lang.Object context,
Authorization auth)
This method associates an Authorization with given context. |
| Field Detail |
|---|
static final java.lang.String USERNAME
Role.getProperties().
static final java.lang.String PASSWORD
User.getCredentials().
static final java.lang.String SHA1_HASH
User.getCredentials().
| Method Detail |
|---|
Authorization login(java.lang.String username,
java.lang.String password)
throws java.lang.Exception
SimpleLogin.login(username, SimpleLogin.PASSWORD, password);
username - the name of the userpassword - the plain password string.
Authorization object
java.lang.Exception - on errorlogin(String, String, Object)
Authorization login(java.lang.String username,
java.lang.String algorithm,
java.lang.Object credential)
throws java.lang.Exception
mbs.useradmin.anonymousConnect is set
true, the implementation should successfully login, even if
the UserAdmin service is missing.
Please not, that this method will automatically associate the authorization
object with the current thread. If you want to associate it with another
object, you should use setAuthorization(Object, Authorization).
This feature allows you to obtain the currently logged user from the
context.
username - the name of the user. If this parameter is given
null value or empty string - anonymous login is
considered.algorithm - the name of the algorithm used for logging. See
SHA1_HASH and PASSWORDcredential - the credentials - e.g. the password itself. If the
algorithm is SHA1_HASH, the value of this argument
should be byte[] containing the SHA1 hash. If
PASSWORD algorithm is used, this arguments should be
the plain password string.
Authorization object or null if
UserAdmin service is not available and
mbs.useradmin.anonymousConnect is set true.
java.lang.Exception - if the authorization has failed because UserAdmin
service not available and the property
mbs.useradmin.anonymousConnect is not set true, or
the user name and the password don't match.
java.lang.NullPointerException - if algorithm or
credential parameter is null.
java.lang.IllegalArgumentException - is SHA1_HASH algorithm is used
and credential is not byte[] containing valid
SHA1 hash.
Authorization setAuthorization(java.lang.Object context,
Authorization auth)
Authorization with given context. The
context can be any kind of object. The service automatically uses the
current thread as context object, to which the Authorization object
is automatically associated, when login(String, String, Object)
method is called.
Associates the authoObject with the given
handle or removes it if the authoObject is null.
context - the association context. If it is null, the
current thread is used by default.auth - the Authorization object to associate with the context.
If this is null, the association is removed.
Authorization or
null if the context was not associated.
java.lang.IllegalArgumentException - if the Authorization object is no
longer valid or already logged out.Authorization getAuthorization(java.lang.Object context)
Authorization object that is associated with the
specified context.
context - the association context. If it is null, the
current thread is used by default.
Authorization, or
null if the context was not associated.
|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||