Package org.apache.activemq.shiro.authc
Class DefaultAuthenticationPolicy
- java.lang.Object
-
- org.apache.activemq.shiro.authc.DefaultAuthenticationPolicy
-
- All Implemented Interfaces:
AuthenticationPolicy
public class DefaultAuthenticationPolicy extends Object implements AuthenticationPolicy
- Since:
- 5.10.0
-
-
Constructor Summary
Constructors Constructor Description DefaultAuthenticationPolicy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.shiro.subject.PrincipalCollectioncreateAssumedIdentity(ConnectionReference conn)Returns a ShiroPrincipalCollectionrepresenting the identity to assume (without true authentication) for the specified Connection.protected booleancredentialsAvailable(ConnectionReference conn)Returnstrueif the client connection has supplied credentials to authenticate itself,falseotherwise.voidcustomizeSubject(org.apache.shiro.subject.Subject.Builder subjectBuilder, ConnectionReference conn)Allows customization of theSubjectbeing built for the specified client connection.StringgetAnonymousAccountRealmName()StringgetAnonymousAccountUsername()StringgetSystemAccountRealmName()StringgetSystemAccountUsername()booleanisAnonymousAccessAllowed()protected booleanisAnonymousAccount(org.apache.shiro.subject.Subject subject)protected booleanisAssumeIdentity(ConnectionReference conn)Returnstrueif an unauthenticated connection should still assume a specific identity,falseotherwise.booleanisAuthenticationRequired(SubjectConnectionReference conn)Returnstrueif the connection'sSubjectinstance should be authenticated,falseotherwise.protected booleanisSystemAccount(org.apache.shiro.subject.Subject subject)protected booleanisSystemConnection(ConnectionReference conn)booleanisVmConnectionAuthenticationRequired()protected booleanmatches(org.apache.shiro.subject.PrincipalCollection principals, String username, String realmName)voidsetAnonymousAccessAllowed(boolean anonymousAccessAllowed)voidsetAnonymousAccountRealmName(String anonymousAccountRealmName)voidsetAnonymousAccountUsername(String anonymousAccountUsername)voidsetSystemAccountRealmName(String systemAccountRealmName)voidsetSystemAccountUsername(String systemAccountUsername)voidsetVmConnectionAuthenticationRequired(boolean vmConnectionAuthenticationRequired)
-
-
-
Method Detail
-
isVmConnectionAuthenticationRequired
public boolean isVmConnectionAuthenticationRequired()
-
setVmConnectionAuthenticationRequired
public void setVmConnectionAuthenticationRequired(boolean vmConnectionAuthenticationRequired)
-
getSystemAccountUsername
public String getSystemAccountUsername()
-
setSystemAccountUsername
public void setSystemAccountUsername(String systemAccountUsername)
-
getSystemAccountRealmName
public String getSystemAccountRealmName()
-
setSystemAccountRealmName
public void setSystemAccountRealmName(String systemAccountRealmName)
-
isAnonymousAccessAllowed
public boolean isAnonymousAccessAllowed()
-
setAnonymousAccessAllowed
public void setAnonymousAccessAllowed(boolean anonymousAccessAllowed)
-
getAnonymousAccountUsername
public String getAnonymousAccountUsername()
-
setAnonymousAccountUsername
public void setAnonymousAccountUsername(String anonymousAccountUsername)
-
getAnonymousAccountRealmName
public String getAnonymousAccountRealmName()
-
setAnonymousAccountRealmName
public void setAnonymousAccountRealmName(String anonymousAccountRealmName)
-
credentialsAvailable
protected boolean credentialsAvailable(ConnectionReference conn)
Returnstrueif the client connection has supplied credentials to authenticate itself,falseotherwise.- Parameters:
conn- the client's connection context- Returns:
trueif the client connection has supplied credentials to authenticate itself,falseotherwise.
-
isAuthenticationRequired
public boolean isAuthenticationRequired(SubjectConnectionReference conn)
Description copied from interface:AuthenticationPolicyReturnstrueif the connection'sSubjectinstance should be authenticated,falseotherwise.- Specified by:
isAuthenticationRequiredin interfaceAuthenticationPolicy- Parameters:
conn- the subject's connection- Returns:
trueif the connection'sSubjectinstance should be authenticated,falseotherwise.
-
isAnonymousAccount
protected boolean isAnonymousAccount(org.apache.shiro.subject.Subject subject)
-
isSystemAccount
protected boolean isSystemAccount(org.apache.shiro.subject.Subject subject)
-
matches
protected boolean matches(org.apache.shiro.subject.PrincipalCollection principals, String username, String realmName)
-
isSystemConnection
protected boolean isSystemConnection(ConnectionReference conn)
-
customizeSubject
public void customizeSubject(org.apache.shiro.subject.Subject.Builder subjectBuilder, ConnectionReference conn)Description copied from interface:AuthenticationPolicyAllows customization of theSubjectbeing built for the specified client connection. This allows for any pre-existing connection-specific identity or state to be applied to theSubject.Builderbefore theSubjectinstance is actually created. NOTE: This method is called by theSubjectFilterbefore the filter chain is executed (and before an authentication attempt occurs). Implementations MUST NOT attempt to actuallybuildthe subject or perform an authentication attempt in this method.- Specified by:
customizeSubjectin interfaceAuthenticationPolicy- Parameters:
subjectBuilder- the builder for the Subject that will be created representing the associated client connectionconn- a reference to the client's connection metadata- See Also:
SubjectFilter
-
isAssumeIdentity
protected boolean isAssumeIdentity(ConnectionReference conn)
Returnstrueif an unauthenticated connection should still assume a specific identity,falseotherwise. This method will only be called if there are no connectioncredentialsAvailable. If a client supplies connection credentials, they will always be used to authenticate the client with that identity. Iftrueis returned, the assumed identity will be returned bycreateAssumedIdentity.Warning
This method exists primarily to support the system and anonymous accounts - it is probably unsafe to returntruein most other scenarios.- Parameters:
conn- a reference to the client's connection- Returns:
trueif an unauthenticated connection should still assume a specific identity,falseotherwise.
-
createAssumedIdentity
protected org.apache.shiro.subject.PrincipalCollection createAssumedIdentity(ConnectionReference conn)
Returns a ShiroPrincipalCollectionrepresenting the identity to assume (without true authentication) for the specified Connection. This method is only called ifisAssumeIdentity(ConnectionReference)istrue.- Parameters:
conn- a reference to the client's connection- Returns:
- a Shiro
PrincipalCollectionrepresenting the identity to assume (without true authentication) for the specified Connection.
-
-