+
+ Set<Authentication> authens = getSubject().getPrincipals(
+ Authentication.class);
+ if (authens != null && !authens.isEmpty()) {
+ Principal principal = authens.iterator().next();
+ Authentication authentication = (Authentication) principal;
+ for (GrantedAuthority ga : authentication.getAuthorities()) {
+ roles.add(ga.getAuthority());
+ }