use of org.jboss.as.domain.management.AuthorizingCallbackHandler in project wildfly by wildfly.
the class RealmDirectLoginModule method handle.
private void handle(final Callback[] callbacks) throws LoginException {
try {
AuthorizingCallbackHandler callbackHandler = getCallbackHandler();
callbackHandler.handle(callbacks);
} catch (IOException e) {
throw SecurityLogger.ROOT_LOGGER.failureCallingSecurityRealm(e.getMessage());
} catch (UnsupportedCallbackException e) {
throw SecurityLogger.ROOT_LOGGER.failureCallingSecurityRealm(e.getMessage());
}
}
use of org.jboss.as.domain.management.AuthorizingCallbackHandler in project wildfly by wildfly.
the class RealmDirectLoginModule method getRoleSets.
@Override
protected Group[] getRoleSets() throws LoginException {
Collection<Principal> principalCol = new HashSet<Principal>();
principalCol.add(new RealmUser(getUsername()));
try {
AuthorizingCallbackHandler callbackHandler = getCallbackHandler();
SubjectUserInfo sui = callbackHandler.createSubjectUserInfo(principalCol);
SimpleGroup sg = new SimpleGroup("Roles");
Set<RealmRole> roles = sui.getSubject().getPrincipals(RealmRole.class);
for (RealmRole current : roles) {
sg.addMember(createIdentity(current.getName()));
}
return new Group[] { sg };
} catch (Exception e) {
throw SecurityLogger.ROOT_LOGGER.failureCallingSecurityRealm(e.getMessage());
}
}
Aggregations