StereotypeProperty.Property stereotypeProperty = attributeProperty.value(); if (IDENTITY_GROUP_NAME.equals(stereotypeProperty)) { for (Partition partition : partitionManager.getPartitions(Partition.class)) { IdentityManager identityManager = partitionManager.createIdentityManager(partition); StereotypeProperty.Property stereotypeProperty = attributeProperty.value(); if (StereotypeProperty.Property.RELATIONSHIP_GROUP_MEMBERSHIP_GROUP.equals(stereotypeProperty)) { groupProperty = property; } else if (StereotypeProperty.Property.RELATIONSHIP_GROUP_MEMBERSHIP_MEMBER.equals(stereotypeProperty)) { memberProperty = property;
StereotypeProperty.Property stereotypeProperty = attributeProperty.value(); if (IDENTITY_ROLE_NAME.equals(stereotypeProperty)) { for (Partition partition : partitionManager.getPartitions(Partition.class)) { IdentityManager identityManager = partitionManager.createIdentityManager(partition); StereotypeProperty.Property stereotypeProperty = attributeProperty.value(); if (StereotypeProperty.Property.RELATIONSHIP_GRANT_ROLE.equals(stereotypeProperty)) { roleProperty = property; } else if (StereotypeProperty.Property.RELATIONSHIP_GRANT_ASSIGNEE.equals(stereotypeProperty)) { accountProperty = property;
StereotypeProperty.Property stereotypeProperty = attributeProperty.value(); if (IDENTITY_ROLE_NAME.equals(stereotypeProperty)) { for (Partition partition : partitionManager.getPartitions(Partition.class)) { IdentityManager identityManager = partitionManager.createIdentityManager(partition); StereotypeProperty.Property stereotypeProperty = attributeProperty.value(); if (StereotypeProperty.Property.RELATIONSHIP_GRANT_ROLE.equals(stereotypeProperty)) { roleProperty = property; } else if (StereotypeProperty.Property.RELATIONSHIP_GRANT_ASSIGNEE.equals(stereotypeProperty)) { accountProperty = property;
StereotypeProperty.Property stereotypeProperty = attributeProperty.value(); if (IDENTITY_GROUP_NAME.equals(stereotypeProperty)) { for (Partition partition : partitionManager.getPartitions(Partition.class)) { IdentityManager identityManager = partitionManager.createIdentityManager(partition); StereotypeProperty.Property stereotypeProperty = attributeProperty.value(); if (StereotypeProperty.Property.RELATIONSHIP_GROUP_MEMBERSHIP_GROUP.equals(stereotypeProperty)) { groupProperty = property; } else if (StereotypeProperty.Property.RELATIONSHIP_GROUP_MEMBERSHIP_MEMBER.equals(stereotypeProperty)) { memberProperty = property;
StereotypeProperty.Property stereotypeProperty = attributeProperty.value(); if (IDENTITY_GROUP_NAME.equals(stereotypeProperty)) { for (Partition partition : partitionManager.getPartitions(Partition.class)) { IdentityManager identityManager = partitionManager.createIdentityManager(partition); StereotypeProperty.Property stereotypeProperty = attributeProperty.value(); if (StereotypeProperty.Property.RELATIONSHIP_GROUP_MEMBERSHIP_GROUP.equals(stereotypeProperty)) { groupProperty = property; } else if (StereotypeProperty.Property.RELATIONSHIP_GROUP_MEMBERSHIP_MEMBER.equals(stereotypeProperty)) { memberProperty = property;
StereotypeProperty.Property stereotypeProperty = attributeProperty.value(); if (IDENTITY_ROLE_NAME.equals(stereotypeProperty)) { for (Partition partition : partitionManager.getPartitions(Partition.class)) { IdentityManager identityManager = partitionManager.createIdentityManager(partition); StereotypeProperty.Property stereotypeProperty = attributeProperty.value(); if (StereotypeProperty.Property.RELATIONSHIP_GRANT_ROLE.equals(stereotypeProperty)) { roleProperty = property; } else if (StereotypeProperty.Property.RELATIONSHIP_GRANT_ASSIGNEE.equals(stereotypeProperty)) { accountProperty = property;
/** * <p>Resolves a {@link org.picketlink.common.properties.Property} from the given <code>type</code> mapped with a certain {@link * org.picketlink.idm.model.annotation.StereotypeProperty.Property}.</p> * * @param type The type. * @param stereotypeProperty The stereotype property to look for. * * @return * * @throws org.picketlink.idm.IdentityManagementException If no property exists in the given type for the given stereotype * property. */ private Property resolveProperty(Class<?> type, StereotypeProperty.Property stereotypeProperty) throws IdentityManagementException { List<Property<Object>> properties = PropertyQueries .createQuery(type) .addCriteria(new AnnotatedPropertyCriteria(StereotypeProperty.class)) .getResultList(); if (properties.isEmpty()) { throw new IdentityManagementException("IdentityType [" + type + "] does not have any property mapped with " + StereotypeProperty.class + "."); } for (Property property : properties) { StereotypeProperty propertyStereotypeProperty = property.getAnnotatedElement().getAnnotation(StereotypeProperty.class); if (stereotypeProperty.equals(propertyStereotypeProperty.value())) { return property; } } throw new IdentityManagementException("Could not resolve property in type [" + type + " for StereotypeProperty [" + stereotypeProperty + "."); }
/** * <p>Resolves a {@link org.picketlink.common.properties.Property} from the given <code>type</code> mapped with a certain {@link * org.picketlink.idm.model.annotation.StereotypeProperty.Property}.</p> * * @param type The type. * @param stereotypeProperty The stereotype property to look for. * * @return * * @throws org.picketlink.idm.IdentityManagementException If no property exists in the given type for the given stereotype * property. */ private Property resolveProperty(Class<?> type, StereotypeProperty.Property stereotypeProperty) throws IdentityManagementException { List<Property<Object>> properties = PropertyQueries .createQuery(type) .addCriteria(new AnnotatedPropertyCriteria(StereotypeProperty.class)) .getResultList(); if (properties.isEmpty()) { throw new IdentityManagementException("IdentityType [" + type + "] does not have any property mapped with " + StereotypeProperty.class + "."); } for (Property property : properties) { StereotypeProperty propertyStereotypeProperty = property.getAnnotatedElement().getAnnotation(StereotypeProperty.class); if (stereotypeProperty.equals(propertyStereotypeProperty.value())) { return property; } } throw new IdentityManagementException("Could not resolve property in type [" + type + " for StereotypeProperty [" + stereotypeProperty + "."); }
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; } }
@Override public String getName() { List<Property<Object>> result = PropertyQueries.createQuery(identity.getAccount().getClass()) .addCriteria(new AnnotatedPropertyCriteria(StereotypeProperty.class)) .getResultList(); for (Property stereotypeProperty : result) { StereotypeProperty stereotypePropertyAnnotation = stereotypeProperty.getAnnotatedElement() .getAnnotation(StereotypeProperty.class); if (StereotypeProperty.Property.IDENTITY_USER_NAME.equals(stereotypePropertyAnnotation.value())) { Object userName = stereotypeProperty.getValue(identity.getAccount()); if (userName != null) { return userName.toString(); } } } return null; } };
@Override public String getName() { List<Property<Object>> result = PropertyQueries.createQuery(identity.getAccount().getClass()) .addCriteria(new AnnotatedPropertyCriteria(StereotypeProperty.class)) .getResultList(); for (Property stereotypeProperty : result) { StereotypeProperty stereotypePropertyAnnotation = stereotypeProperty.getAnnotatedElement() .getAnnotation(StereotypeProperty.class); if (StereotypeProperty.Property.IDENTITY_USER_NAME.equals(stereotypePropertyAnnotation.value())) { Object userName = stereotypeProperty.getValue(identity.getAccount()); if (userName != null) { return userName.toString(); } } } return null; } };
private IdentityType resolveIdentityTypeFromToken(Token currentToken, Object[] queryParameterValues, StereotypeProperty stereotypeProperty) { IdentityType identityType; try { identityType = (IdentityType) queryParameterValues[0]; } catch (ClassCastException cce) { throw new IdentityManagementException("Query parameter value is not an IdentityType instance.", cce); } if (identityType == null) { throw new IdentityManagementException("Query parameter value can not be null."); } if (StereotypeProperty.Property.RELATIONSHIP_GRANT_ROLE.equals(stereotypeProperty.value())) { return extractIdentityTypeFromToken(currentToken, identityType, StereotypeProperty.Property.IDENTITY_ROLE_NAME); } else if (StereotypeProperty.Property.RELATIONSHIP_GRANT_ASSIGNEE.equals(stereotypeProperty.value()) || StereotypeProperty.Property.RELATIONSHIP_GROUP_MEMBERSHIP_MEMBER.equals(stereotypeProperty.value())) { return extractIdentityTypeFromToken(currentToken, identityType, StereotypeProperty.Property.IDENTITY_USER_NAME); } else if (StereotypeProperty.Property.RELATIONSHIP_GROUP_MEMBERSHIP_GROUP.equals(stereotypeProperty.value())) { return extractIdentityTypeFromToken(currentToken, identityType, StereotypeProperty.Property.IDENTITY_GROUP_NAME); } throw new IdentityManagementException("Could not resolve any IdentityType [" + identityType + "] from Token [" + currentToken + "."); }
private IdentityType resolveIdentityTypeFromToken(Token currentToken, Object[] queryParameterValues, StereotypeProperty stereotypeProperty) { IdentityType identityType; try { identityType = (IdentityType) queryParameterValues[0]; } catch (ClassCastException cce) { throw new IdentityManagementException("Query parameter value is not an IdentityType instance.", cce); } if (identityType == null) { throw new IdentityManagementException("Query parameter value can not be null."); } if (StereotypeProperty.Property.RELATIONSHIP_GRANT_ROLE.equals(stereotypeProperty.value())) { return extractIdentityTypeFromToken(currentToken, identityType, StereotypeProperty.Property.IDENTITY_ROLE_NAME); } else if (StereotypeProperty.Property.RELATIONSHIP_GRANT_ASSIGNEE.equals(stereotypeProperty.value()) || StereotypeProperty.Property.RELATIONSHIP_GROUP_MEMBERSHIP_MEMBER.equals(stereotypeProperty.value())) { return extractIdentityTypeFromToken(currentToken, identityType, StereotypeProperty.Property.IDENTITY_USER_NAME); } else if (StereotypeProperty.Property.RELATIONSHIP_GROUP_MEMBERSHIP_GROUP.equals(stereotypeProperty.value())) { return extractIdentityTypeFromToken(currentToken, identityType, StereotypeProperty.Property.IDENTITY_GROUP_NAME); } throw new IdentityManagementException("Could not resolve any IdentityType [" + identityType + "] from Token [" + currentToken + "."); }
private Property resolveProperty(Class<? extends IdentityType> identityType, StereotypeProperty.Property stereotypeProperty) { List<Property<Object>> properties = PropertyQueries .createQuery(identityType) .addCriteria(new AnnotatedPropertyCriteria(StereotypeProperty.class)) .getResultList(); if (properties.isEmpty()) { throw new IdentityManagementException("IdentityType [" + identityType + "] does not have any property mapped with " + StereotypeProperty.class + "."); } for (Property property : properties) { StereotypeProperty propertyStereotypeProperty = property.getAnnotatedElement().getAnnotation(StereotypeProperty.class); if (stereotypeProperty.equals(propertyStereotypeProperty.value())) { return property; } } throw new IdentityManagementException("Could not resolve property in type [" + identityType + " for StereotypeProperty [" + stereotypeProperty + "."); }
@Override public String getName() { List<Property<Object>> result = PropertyQueries.createQuery(identity.getAccount().getClass()) .addCriteria(new AnnotatedPropertyCriteria(StereotypeProperty.class)) .getResultList(); for (Property stereotypeProperty : result) { StereotypeProperty stereotypePropertyAnnotation = stereotypeProperty.getAnnotatedElement() .getAnnotation(StereotypeProperty.class); if (StereotypeProperty.Property.IDENTITY_USER_NAME.equals(stereotypePropertyAnnotation.value())) { Object userName = stereotypeProperty.getValue(identity.getAccount()); if (userName != null) { return userName.toString(); } } } return null; } };
private Property resolveProperty(Class<? extends IdentityType> identityType, StereotypeProperty.Property stereotypeProperty) { List<Property<Object>> properties = PropertyQueries .createQuery(identityType) .addCriteria(new AnnotatedPropertyCriteria(StereotypeProperty.class)) .getResultList(); if (properties.isEmpty()) { throw new IdentityManagementException("IdentityType [" + identityType + "] does not have any property mapped with " + StereotypeProperty.class + "."); } for (Property property : properties) { StereotypeProperty propertyStereotypeProperty = property.getAnnotatedElement().getAnnotation(StereotypeProperty.class); if (stereotypeProperty.equals(propertyStereotypeProperty.value())) { return property; } } throw new IdentityManagementException("Could not resolve property in type [" + identityType + " for StereotypeProperty [" + stereotypeProperty + "."); }
protected Property getDefaultLoginNameProperty(Class<? extends Account> accountType) { List<Property<Object>> properties = PropertyQueries .createQuery(accountType) .addCriteria(new AnnotatedPropertyCriteria(StereotypeProperty.class)).getResultList(); for (Property property : properties) { StereotypeProperty stereotypeProperty = property.getAnnotatedElement().getAnnotation(StereotypeProperty.class); if (StereotypeProperty.Property.IDENTITY_USER_NAME.equals(stereotypeProperty.value())) { return property; } } throw IDMMessages.MESSAGES.credentialUnknownUserNameProperty(accountType); } }
protected Property getDefaultLoginNameProperty(Class<? extends Account> accountType) { List<Property<Object>> properties = PropertyQueries .createQuery(accountType) .addCriteria(new AnnotatedPropertyCriteria(StereotypeProperty.class)).getResultList(); for (Property property : properties) { StereotypeProperty stereotypeProperty = property.getAnnotatedElement().getAnnotation(StereotypeProperty.class); if (StereotypeProperty.Property.IDENTITY_USER_NAME.equals(stereotypeProperty.value())) { return property; } } throw IDMMessages.MESSAGES.credentialUnknownUserNameProperty(accountType); } }
protected Property getDefaultLoginNameProperty(Class<? extends Account> accountType) { List<Property<Object>> properties = PropertyQueries .createQuery(accountType) .addCriteria(new AnnotatedPropertyCriteria(StereotypeProperty.class)).getResultList(); for (Property property : properties) { StereotypeProperty stereotypeProperty = property.getAnnotatedElement().getAnnotation(StereotypeProperty.class); if (StereotypeProperty.Property.IDENTITY_USER_NAME.equals(stereotypeProperty.value())) { return property; } } throw IDMMessages.MESSAGES.credentialUnknownUserNameProperty(accountType); }