Package sonia.scm.security
Class DAORealmHelper
java.lang.Object
sonia.scm.security.DAORealmHelper
The
DAORealmHelper provides a simple way to authenticate against the
UserDAO. The class is used by the default and the legacy realm.- Since:
- 2.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassBuilder class forAuthenticationInfo. -
Constructor Summary
ConstructorsConstructorDescriptionDAORealmHelper(LoginAttemptHandler loginAttemptHandler, UserDAO userDAO, String realm) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionauthenticationInfoBuilder(String principal) org.apache.shiro.authc.AuthenticationInfogetAuthenticationInfo(org.apache.shiro.authc.AuthenticationToken token) CreatesAuthenticationInfofrom aUsernamePasswordToken.org.apache.shiro.authc.credential.CredentialsMatcherwrapCredentialsMatcher(org.apache.shiro.authc.credential.CredentialsMatcher credentialsMatcher) Wraps credentials matcher and applies login attempt policies.
-
Constructor Details
-
DAORealmHelper
Constructs a new instance. Consider to useDAORealmHelperFactorywhich handles dependency injection.- Parameters:
loginAttemptHandler- login attempt handler for wrapping credentials matcheruserDAO- user daorealm- name of realm
-
-
Method Details
-
wrapCredentialsMatcher
public org.apache.shiro.authc.credential.CredentialsMatcher wrapCredentialsMatcher(org.apache.shiro.authc.credential.CredentialsMatcher credentialsMatcher) Wraps credentials matcher and applies login attempt policies.- Parameters:
credentialsMatcher- credentials matcher to wrap- Returns:
- wrapped credentials matcher
-
getAuthenticationInfo
public org.apache.shiro.authc.AuthenticationInfo getAuthenticationInfo(org.apache.shiro.authc.AuthenticationToken token) CreatesAuthenticationInfofrom aUsernamePasswordToken. The method acceptsAuthenticationInfoas argument, so that the caller does not need to cast.- Parameters:
token- authentication token, it must beUsernamePasswordToken- Returns:
- authentication info
-
authenticationInfoBuilder
-