public class SimpleAuthenticationInfo extends Objectimplements MergableAuthenticationInfo , SaltedAuthenticationInfo
MergableAuthenticationInfo interface that holds the principals and credentials.
AuthenticatingRealm,
Serialized Form
| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
SimpleAuthenticationInfo()
Default no-argument constructor.
|
SimpleAuthenticationInfo(Object
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
Constructor that takes in a single 'primary' principal of the account and its corresponding credentials, associated with the specified realm.
|
SimpleAuthenticationInfo(PrincipalCollection
Constructor that takes in an account's identifying principal(s) and its corresponding credentials that verify the principals.
|
SimpleAuthenticationInfo(PrincipalCollection
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.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object
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
Takes the specified
info argument and adds its principals and credentials into this instance.
|
void |
setCredentials(Object
Sets the credentials that verify the principals/identity of the associated Realm account.
|
void |
setCredentialsSalt(ByteSource
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
Sets the identifying principal(s) represented by this instance.
|
String |
toString()
Simple implementation that merely returns
|
protected PrincipalCollectionprincipals
protected Objectcredentials
protected ByteSourcecredentialsSalt
public SimpleAuthenticationInfo()
public SimpleAuthenticationInfo(Objectprincipal, 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(Objectprincipal, 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 hashedCredentials
realmName - the realm from where the principal and credentials were acquired.
HashedCredentialsMatcher
public SimpleAuthenticationInfo(PrincipalCollectionprincipals, Object credentials)
principals - a Realm's account's identifying principal(s)
credentials - the accounts corresponding principals that verify the principals.
public SimpleAuthenticationInfo(PrincipalCollectionprincipals, 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
public PrincipalCollectiongetPrincipals()
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(PrincipalCollectionprincipals)
principals - the indentifying attributes of the corresponding Realm account.
public ObjectgetCredentials()
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(Objectcredentials)
credentials - attribute(s) that verify the account's identity/principals, such as a password or private key.
public ByteSourcegetCredentialsSalt()
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(ByteSourcesalt)
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(AuthenticationInfoinfo)
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(Objecto)
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 StringtoString()
principals.toString()
toString in class
Object
principals.toString()