wunmiji commented on issue #1091:
URL: https://github.com/apache/shiro/issues/1091#issuecomment-1741816361
Thanks.
Working now
EmployeeRealm.java
```
@Named("NamedEmployeeRealm")
@ApplicationScoped
public class EmployeeRealm extends AuthorizingRealm {
@Inject
AuthenticateFactory factory;
@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection
principalCollection) {
return null;
}
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken
authenticationToken) throws AuthenticationException {
UsernamePasswordToken usernamePasswordToken =
(UsernamePasswordToken) authenticationToken;
String username = usernamePasswordToken.getUsername();
char[] password = usernamePasswordToken.getPassword();
if (username == null) throw new AccountException("Null usernames!");
if (password == null) throw new AccountException("Null passwords!");
Object[] secret = factory.getSecret(username);
System.out.println(secret[0]);
System.out.println(secret[1]);
System.out.println(secret[2]);
return new SimpleAuthenticationInfo(username, password,
"EmployeeRealm");
}
}
```
shiro.ini
```
[main]
# Objects and their properties are defined here,
# Such as the securityManager, Realms and anything
# else needed to build the SecurityManager
employeeRealm = NamedEmployeeRealm
employeeRealmSimpleCredentialsMatcher =
org.apache.shiro.authc.credential.SimpleCredentialsMatcher
employeeRealm.credentialsMatcher = $employeeRealmSimpleCredentialsMatcher
securityManager.realms = $employeeRealm
#
-----------------------------------------------------------------------------
# Users and their (optional) assigned roles
# username = password, role1, role2, ..., roleN
#
-----------------------------------------------------------------------------
[users]
# The 'users' section is for simple deployments
# when you only need a small number of statically-defined
# set of User accounts.
#
-----------------------------------------------------------------------------
# Roles with assigned permissions
# roleName = perm1, perm2, ..., permN
#
-----------------------------------------------------------------------------
[roles]
# The 'roles' section is for simple deployments
# when you only need a small number of statically-defined
# 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]