|
JSecurity | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jsecurity.authc.SimpleAccount
public class SimpleAccount
Simple implementation of the Account interface that
contains principal and credential information as instance variables and exposes them
via getters and setters using standard JavaBean notation.
Realm implementations can use this for simple principal/credential accounts, but note:
This class cannot perform its own authorization checks for roles and permissions. It is therefore not sufficient
to use to back a Realm's Authorizer method implementations. If you need
an Account object to perform role and permission checks itself, you might want to use instaces of
SimpleAuthorizingAccount instead of this class.
But note that a SimpleAuthorizingAccount object caches its roles and permission definitions and will not persist any changes to these definitions back to the source Realm. If you need dynamic runtime modification of Roles and/or Permissions for any given account, your Realm implementation will need to perform the authorization checks directly since instances of this class are primarily used for caching and could represent stale data.
SimpleAuthorizingAccount,
Serialized Form| Field Summary | |
|---|---|
protected Log |
logger
|
| Constructor Summary | |
|---|---|
SimpleAccount()
|
|
SimpleAccount(Object principal,
Object credentials)
|
|
SimpleAccount(Object principal,
Object credentials,
boolean locked,
boolean credentialsExpired)
|
|
| Method Summary | |
|---|---|
boolean |
equals(Object o)
|
Object |
getCredentials()
The account's credentials as stored in the system associated with the account identifier, such as a password or private key. |
Object |
getPrincipal()
Returns the account's identifying principal, such as a user id or username. |
int |
hashCode()
|
boolean |
isCredentialsExpired()
Determines if the user's credentials (e.g. password) have expired and must be changed before login is allowed. |
boolean |
isLocked()
Determines if the account is locked, meaning that the user is not allowed to log in due to a manual or automatic lockout. |
void |
merge(Account otherAccount)
Merges (adds) the specified Account data into this instance. |
void |
setCredentials(Object credentials)
|
void |
setCredentialsExpired(boolean credentialsExpired)
|
void |
setLocked(boolean locked)
|
void |
setPrincipal(Object principal)
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final transient Log logger
| Constructor Detail |
|---|
public SimpleAccount()
public SimpleAccount(Object principal,
Object credentials)
public SimpleAccount(Object principal,
Object credentials,
boolean locked,
boolean credentialsExpired)
| Method Detail |
|---|
public Object getPrincipal()
AccountIn a multi-realm configuration, the object returned from this method might be an implementation-specific object representing multiple principals. This might be an instance of java.util.Collection, but it does not have to be - it is up to the Authenticator's modular authentication strategy as to exactly what is returned.
getPrincipal in interface Accountpublic void setPrincipal(Object principal)
public Object getCredentials()
Accountaccount identifier, such as a password or private key.
It could be encrypted in which case an
Realm
must be aware of the fact (e.g. via configuration) in order to interpret and compare
the credentials value.
getCredentials in interface Accountidentifierpublic void setCredentials(Object credentials)
public boolean isLocked()
Account
isLocked in interface Accountpublic void setLocked(boolean locked)
public boolean isCredentialsExpired()
Account
isCredentialsExpired in interface Accountpublic void setCredentialsExpired(boolean credentialsExpired)
public void merge(Account otherAccount)
Realms Realms, not just one realm.
This is useful in a multi-realm authentication configuration - the individual Account
objects obtained from each realm can be merged into this object. This single object can then be
returned at the end of the authentication process, giving the impression of a single underlying
realm/data source.
otherAccount - the account whos data will be merged (added) into this instance.public int hashCode()
hashCode in class Objectpublic boolean equals(Object o)
equals in class Objectpublic String toString()
toString in class Object
|
JSecurity | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||