@StereotypeProperty(RELATIONSHIP_GRANT_ROLE) public Role getRole() { return role; }
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 + "."); }
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); }
@StereotypeProperty(RELATIONSHIP_GRANT_ROLE) public Role getRole() { return role; }
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); }
@StereotypeProperty(RELATIONSHIP_GROUP_MEMBERSHIP_GROUP) public Group getGroup() { return group; }
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); } }
@StereotypeProperty(RELATIONSHIP_GROUP_MEMBERSHIP_GROUP) public Group getGroup() { return group; }
@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 static final long serialVersionUID = -6118293036241099199L; @StereotypeProperty(IDENTITY_ID) private String id;
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); }
private static final long serialVersionUID = -6118293036241099199L; @StereotypeProperty(IDENTITY_ID) private String id;
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 + "."); }
@AttributeProperty @StereotypeProperty(IDENTITY_GROUP_NAME) public String getName() { return name; }
@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; } };
@InheritsPrivileges("group") @StereotypeProperty(RELATIONSHIP_GROUP_MEMBERSHIP_MEMBER) public Account getMember() { return member; }
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); } }
@InheritsPrivileges("group") @StereotypeProperty(RELATIONSHIP_GROUP_MEMBERSHIP_MEMBER) public Account getMember() { return member; }
@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; } };