boolean isValid = authenticationManager.isValid(userPrincipal, credentials, subject);
if (isValid) {
SecurityContext sc = SecurityActions.createSecurityContext(authenticationManager.getSecurityDomain());
sc.getUtil().createSubjectInfo(userPrincipal, credentials, subject);
SecurityActions.setSecurityContextOnAssociation(sc);
SecurityContextCallbackHandler scb = new SecurityContextCallbackHandler(sc);
RoleGroup roles = authorizationManager.getSubjectRoles(subject, scb);
List<Role> rolesAsList = roles.getRoles();
List<String> rolesAsStringList = new ArrayList<String>();
for (Role role : rolesAsList) {
rolesAsStringList.add(role.getRoleName());