wunmiji commented on issue #1101:
URL: https://github.com/apache/shiro/issues/1101#issuecomment-1747962520
Method 1
password = 123456
Hashpassword : 2R7mQYMu3OkORIEbRJY/AqvDqWvVAoFIhXMBa8dwh2o=
Salt = 25+ri82pdmDMrcUHpFOaCg==
EmployeeRealm
```
@Named("NamedEmployeeRealm")
@ApplicationScoped
public class EmployeeRealm extends AuthorizingRealm {
@Inject
AuthenticateFactory factory;
@Inject
ApacheShiroSecurity security;
@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection
principalCollection) {
return null;
}
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken
authenticationToken) throws AuthenticationException {
UsernamePasswordToken token = (UsernamePasswordToken)
authenticationToken;
String username = token.getUsername();
char[] passwordChar = token.getPassword();
if (username == null) throw new AccountException("Null usernames!");
if (passwordChar == null) throw new AccountException("Null
passwords!");
String password = new String(passwordChar);
// Return the authentication info
return new SimpleAuthenticationInfo(username ,
"2R7mQYMu3OkORIEbRJY/AqvDqWvVAoFIhXMBa8dwh2o=",
ByteSource.Util.bytes("25+ri82pdmDMrcUHpFOaCg=="), getName());
}
```
shiro.ini
```
[main]
# Objects and their properties are defined here,
# Such as the securityManager, Realms and anything
# else needed to build the SecurityManager
credentialsMatcher =
org.apache.shiro.authc.credential.Sha256CredentialsMatcher
# base64 encoding, not hex in this example:
credentialsMatcher.storedCredentialsHexEncoded = false
credentialsMatcher.hashIterations = 1024
employeeRealm = NamedEmployeeRealm
employeeRealm.credentialsMatcher = $credentialsMatcher
securityManager.realms = $employeeRealm
sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager
securityManager.sessionManager = $sessionManager
securityManager.sessionManager.sessionIdCookieEnabled = false
#
-----------------------------------------------------------------------------
# Users and their (optional) assigned roles
#
-----------------------------------------------------------------------------
[users]
#
-----------------------------------------------------------------------------
# Roles with assigned permissions
#
-----------------------------------------------------------------------------
[roles]
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]