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 TypeClassDescriptionclass
Builder 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.AuthenticationInfo
getAuthenticationInfo
(org.apache.shiro.authc.AuthenticationToken token) CreatesAuthenticationInfo
from aUsernamePasswordToken
.org.apache.shiro.authc.credential.CredentialsMatcher
wrapCredentialsMatcher
(org.apache.shiro.authc.credential.CredentialsMatcher credentialsMatcher) Wraps credentials matcher and applies login attempt policies.
-
Constructor Details
-
DAORealmHelper
Constructs a new instance. Consider to useDAORealmHelperFactory
which 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) CreatesAuthenticationInfo
from aUsernamePasswordToken
. The method acceptsAuthenticationInfo
as argument, so that the caller does not need to cast.- Parameters:
token
- authentication token, it must beUsernamePasswordToken
- Returns:
- authentication info
-
authenticationInfoBuilder
-