ejb3/src/main/java/org/jboss/as/ejb3/security/JaccInterceptor.java
public static Principal[] getGrantedRoles(SecurityIdentity securityIdentity) {
        Set<String> roles = new HashSet<>();

        for (String s : securityIdentity.getRoles("ejb")) {
            roles.add(s);
        }
        List<Principal> list = new ArrayList<>();
        Function<String, Principal> mapper = roleName -> (Principal) () -> roleName;
        for (String role : roles) {
            Principal principal = mapper.apply(role);
            list.add(principal);
        }
        return list.toArray(NO_PRINCIPALS);
    }
public static Principal[] getGrantedRoles(SecurityIdentity securityIdentity) {
        Set<String> roles = new HashSet<>();

        for (String s : securityIdentity.getRoles("ejb")) {
            roles.add(s);
        }
        List<Principal> list = new ArrayList<>();
        Function<String, Principal> mapper = roleName -> (Principal) () -> roleName;
        for (String role : roles) {
            Principal principal = mapper.apply(role);
            list.add(principal);
        }
        return list.toArray(NO_PRINCIPALS);
    }
Returns an array of {@link Principal} representing the roles associated with the identity
invoking the EJB. This method will check performs checks against run as identities in order to
resolve the correct set of roles to be granted.

@param securityIdentity the identity invoking the EJB
@return an array of {@link Principal} representing the roles associated with the identity