}
protected UserSubject getGrantSubject(Message message, SamlAssertionWrapper wrapper) {
SecurityContext sc = scProvider.getSecurityContext(message, wrapper);
if (sc instanceof JAXRSSAMLSecurityContext) {
JAXRSSAMLSecurityContext jaxrsSc = (JAXRSSAMLSecurityContext)sc;
Set<Principal> rolesP = jaxrsSc.getUserRoles();
List<String> roles = new ArrayList<String>();
if (roles != null) {
for (Principal p : rolesP) {
roles.add(p.getName());
}
}
return new SamlUserSubject(jaxrsSc.getUserPrincipal().getName(),
roles,
jaxrsSc.getClaims());
} else {
return new UserSubject(sc.getUserPrincipal().getName());
}
}