Package org.apache.activemq.shiro.authc
Class DefaultAuthenticationPolicy
java.lang.Object
org.apache.activemq.shiro.authc.DefaultAuthenticationPolicy
- All Implemented Interfaces:
AuthenticationPolicy
- Since:
- 5.10.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.shiro.subject.PrincipalCollectionReturns a ShiroPrincipalCollectionrepresenting the identity to assume (without true authentication) for the specified Connection.protected booleanReturnstrueif 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.booleanprotected booleanisAnonymousAccount(org.apache.shiro.subject.Subject subject) protected booleanReturnstrueif an unauthenticated connection should still assume a specific identity,falseotherwise.booleanReturnstrueif the connection'sSubjectinstance should be authenticated,falseotherwise.protected booleanisSystemAccount(org.apache.shiro.subject.Subject subject) protected booleanbooleanprotected booleanvoidsetAnonymousAccessAllowed(boolean anonymousAccessAllowed) voidsetAnonymousAccountRealmName(String anonymousAccountRealmName) voidsetAnonymousAccountUsername(String anonymousAccountUsername) voidsetSystemAccountRealmName(String systemAccountRealmName) voidsetSystemAccountUsername(String systemAccountUsername) voidsetVmConnectionAuthenticationRequired(boolean vmConnectionAuthenticationRequired)
-
Constructor Details
-
DefaultAuthenticationPolicy
public DefaultAuthenticationPolicy()
-
-
Method Details
-
isVmConnectionAuthenticationRequired
public boolean isVmConnectionAuthenticationRequired() -
setVmConnectionAuthenticationRequired
public void setVmConnectionAuthenticationRequired(boolean vmConnectionAuthenticationRequired) -
getSystemAccountUsername
-
setSystemAccountUsername
-
getSystemAccountRealmName
-
setSystemAccountRealmName
-
isAnonymousAccessAllowed
public boolean isAnonymousAccessAllowed() -
setAnonymousAccessAllowed
public void setAnonymousAccessAllowed(boolean anonymousAccessAllowed) -
getAnonymousAccountUsername
-
setAnonymousAccountUsername
-
getAnonymousAccountRealmName
-
setAnonymousAccountRealmName
-
credentialsAvailable
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
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
-
isSystemConnection
-
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:
-
isAssumeIdentity
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.
-