|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.shiro.authc.SimpleAuthenticationInfo
public class SimpleAuthenticationInfo
Simple implementation of the MergableAuthenticationInfo
interface that holds the principals and
credentials.
AuthenticatingRealm
,
Serialized FormField Summary | |
---|---|
protected Object |
credentials
The credentials verifying the account principals. |
protected ByteSource |
credentialsSalt
Any salt used in hashing the credentials. |
protected PrincipalCollection |
principals
The principals identifying the account associated with this AuthenticationInfo instance. |
Constructor Summary | |
---|---|
SimpleAuthenticationInfo()
Default no-argument constructor. |
|
SimpleAuthenticationInfo(Object principal,
Object hashedCredentials,
ByteSource credentialsSalt,
String realmName)
Constructor that takes in a single 'primary' principal of the account, its corresponding hashed credentials, the salt used to hash the credentials, and the name of the realm to associate with the principals. |
|
SimpleAuthenticationInfo(Object principal,
Object credentials,
String realmName)
Constructor that takes in a single 'primary' principal of the account and its corresponding credentials, associated with the specified realm. |
|
SimpleAuthenticationInfo(PrincipalCollection principals,
Object credentials)
Constructor that takes in an account's identifying principal(s) and its corresponding credentials that verify the principals. |
|
SimpleAuthenticationInfo(PrincipalCollection principals,
Object hashedCredentials,
ByteSource credentialsSalt)
Constructor that takes in an account's identifying principal(s), hashed credentials used to verify the principals, and the salt used when hashing the credentials. |
Method Summary | |
---|---|
boolean |
equals(Object o)
Returns true if the Object argument is an instanceof SimpleAuthenticationInfo and
its principals are equal to this instance's principals, false otherwise. |
Object |
getCredentials()
Returns the credentials associated with the corresponding Subject. |
ByteSource |
getCredentialsSalt()
Returns the salt used to hash the credentials, or null if no salt was used or credentials were not
hashed at all. |
PrincipalCollection |
getPrincipals()
Returns all principals associated with the corresponding Subject. |
int |
hashCode()
Returns the hashcode of the internal principals instance. |
void |
merge(AuthenticationInfo info)
Takes the specified info argument and adds its principals and credentials into this instance. |
void |
setCredentials(Object credentials)
Sets the credentials that verify the principals/identity of the associated Realm account. |
void |
setCredentialsSalt(ByteSource salt)
Sets the salt used to hash the credentials, or null if no salt was used or credentials were not
hashed at all. |
void |
setPrincipals(PrincipalCollection principals)
Sets the identifying principal(s) represented by this instance. |
String |
toString()
Simple implementation that merely returns
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected PrincipalCollection principals
protected Object credentials
protected ByteSource credentialsSalt
Constructor Detail |
---|
public SimpleAuthenticationInfo()
public SimpleAuthenticationInfo(Object principal, Object credentials, String realmName)
PrincipalCollection
based
on the principal
and realmName
argument.
principal
- the 'primary' principal associated with the specified realm.credentials
- the credentials that verify the given principal.realmName
- the realm from where the principal and credentials were acquired.public SimpleAuthenticationInfo(Object principal, Object hashedCredentials, ByteSource credentialsSalt, String realmName)
PrincipalCollection
based
on the principal
and realmName
argument.
principal
- the 'primary' principal associated with the specified realm.hashedCredentials
- the hashed credentials that verify the given principal.credentialsSalt
- the salt used when hashing the given hashedCredentialsrealmName
- the realm from where the principal and credentials were acquired.HashedCredentialsMatcher
public SimpleAuthenticationInfo(PrincipalCollection principals, Object credentials)
principals
- a Realm's account's identifying principal(s)credentials
- the accounts corresponding principals that verify the principals.public SimpleAuthenticationInfo(PrincipalCollection principals, Object hashedCredentials, ByteSource credentialsSalt)
principals
- a Realm's account's identifying principal(s)hashedCredentials
- the hashed credentials that verify the principals.credentialsSalt
- the salt used when hashing the hashedCredentials.HashedCredentialsMatcher
Method Detail |
---|
public PrincipalCollection getPrincipals()
AuthenticationInfo
Subject
.
The returned PrincipalCollection should not contain any credentials used to verify principals, such
as passwords, private keys, etc. Those should be instead returned by getCredentials()
.
getPrincipals
in interface AuthenticationInfo
public void setPrincipals(PrincipalCollection principals)
principals
- the indentifying attributes of the corresponding Realm account.public Object getCredentials()
AuthenticationInfo
principals
associated with the Subject, such as a password or private key. Credentials
are used by Shiro particularly during the authentication process to ensure that submitted credentials
during a login attempt match exactly the credentials here in the AuthenticationInfo
instance.
getCredentials
in interface AuthenticationInfo
public void setCredentials(Object credentials)
credentials
- attribute(s) that verify the account's identity/principals, such as a password or private key.public ByteSource getCredentialsSalt()
null
if no salt was used or credentials were not
hashed at all.
Note that this attribute is NOT handled in the
merge
method - a hash salt is only useful within a single realm (as each
realm will perform it's own Credentials Matching logic), and once finished in that realm, Shiro has no further
use for salts. Therefore it doesn't make sense to 'merge' salts in a multi-realm scenario.
getCredentialsSalt
in interface SaltedAuthenticationInfo
null
if no salt was used or credentials were not
hashed at all.public void setCredentialsSalt(ByteSource salt)
null
if no salt was used or credentials were not
hashed at all.
Note that this attribute is NOT handled in the
merge
method - a hash salt is only useful within a single realm (as each
realm will perform it's own Credentials Matching logic), and once finished in that realm, Shiro has no further
use for salts. Therefore it doesn't make sense to 'merge' salts in a multi-realm scenario.
salt
- the salt used to hash the credentials, or null
if no salt was used or credentials were not
hashed at all.public void merge(AuthenticationInfo info)
info
argument and adds its principals and credentials into this instance.
merge
in interface MergableAuthenticationInfo
info
- the AuthenticationInfo
to add into this instance.public boolean equals(Object o)
true
if the Object argument is an instanceof SimpleAuthenticationInfo
and
its principals
are equal to this instance's principals, false
otherwise.
equals
in class Object
o
- the object to compare for equality.
true
if the Object argument is an instanceof SimpleAuthenticationInfo
and
its principals
are equal to this instance's principals, false
otherwise.public int hashCode()
principals
instance.
hashCode
in class Object
principals
instance.public String toString()
principals
.toString()
toString
in class Object
principals
.toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |