private boolean hasIdentityType(T token, StereotypeProperty.Property stereotypeProperty, Object identifier) { if (StereotypeProperty.Property.IDENTITY_ROLE_NAME.equals(stereotypeProperty)) { Set<String> roleNames = extractRoles(token); if (roleNames.contains(identifier)) { return true; } } if (StereotypeProperty.Property.IDENTITY_GROUP_NAME.equals(stereotypeProperty)) { Set<String> groupNames = extractGroups(token); if (groupNames.contains(identifier)) { return true; } } if (StereotypeProperty.Property.IDENTITY_USER_NAME.equals(stereotypeProperty) || StereotypeProperty.Property.IDENTITY_ID.equals(stereotypeProperty)) { String subject = extractSubject(token); if (subject != null && identifier.equals(subject)) { return true; } } return false; } }
private boolean hasIdentityType(T token, StereotypeProperty.Property stereotypeProperty, Object identifier) { if (StereotypeProperty.Property.IDENTITY_ROLE_NAME.equals(stereotypeProperty)) { Set<String> roleNames = extractRoles(token); if (roleNames.contains(identifier)) { return true; } } if (StereotypeProperty.Property.IDENTITY_GROUP_NAME.equals(stereotypeProperty)) { Set<String> groupNames = extractGroups(token); if (groupNames.contains(identifier)) { return true; } } if (StereotypeProperty.Property.IDENTITY_USER_NAME.equals(stereotypeProperty) || StereotypeProperty.Property.IDENTITY_ID.equals(stereotypeProperty)) { String subject = extractSubject(token); if (subject != null && identifier.equals(subject)) { return true; } } return false; } }