diff --git a/modules/charon-core/src/main/java/org/wso2/charon3/core/objects/RoleV2.java b/modules/charon-core/src/main/java/org/wso2/charon3/core/objects/RoleV2.java index 107d2e1ce..06f3443e6 100644 --- a/modules/charon-core/src/main/java/org/wso2/charon3/core/objects/RoleV2.java +++ b/modules/charon-core/src/main/java/org/wso2/charon3/core/objects/RoleV2.java @@ -377,6 +377,34 @@ public void setAssociatedApplications(List associatedApp displayDefinition, null, null, refDefinition); } + /** + * Set the role properties of the role. + * + * @param rolePropertiesList List of role properties. + */ + public void setRoleProperties(List rolePropertiesList) { + + SCIMAttributeSchema complexDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.ROLE_V2_PROPERTIES; + SCIMAttributeSchema valueDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.ROLE_V2_PROPERTY_VALUE; + SCIMAttributeSchema displayDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.ROLE_V2_PROPERTY_NAME; + addMultivaluedComplexAtribute(rolePropertiesList, complexDefinition, valueDefinition, displayDefinition, + null, null, null); + } + + /** + * Get the role properties of the role. + * + * @return List of role properties. + */ + public List getRoleProperties() { + + SCIMAttributeSchema complexDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.ROLE_V2_PROPERTIES; + SCIMAttributeSchema valueDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.ROLE_V2_PROPERTY_VALUE; + SCIMAttributeSchema displayDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.ROLE_V2_PROPERTY_NAME; + return getMultivaluedComplexType(complexDefinition, valueDefinition, displayDefinition, null, + null, null).orElse(Collections.emptyList()); + } + /** * Get the audience of the role. */ diff --git a/modules/charon-core/src/main/java/org/wso2/charon3/core/schema/SCIMConstants.java b/modules/charon-core/src/main/java/org/wso2/charon3/core/schema/SCIMConstants.java index 2d119daa1..204ce1a14 100644 --- a/modules/charon-core/src/main/java/org/wso2/charon3/core/schema/SCIMConstants.java +++ b/modules/charon-core/src/main/java/org/wso2/charon3/core/schema/SCIMConstants.java @@ -550,6 +550,10 @@ public static class RoleSchemaConstants { public static final String DISPLAY = "display"; public static final String VALUE = "value"; public static final String TYPE = "type"; + public static final String ROLE_PROPERTIES_URI = + "urn:ietf:params:scim:schemas:extension:2.0:Role:roleProperties"; + public static final String ROLE_PROPERTIES = "roleProperties"; + public static final String ROLE_PROPERTY_NAME = "name"; // Possible canonical values for audience type attribute. public static final String APPLICATION = "application"; @@ -583,6 +587,9 @@ public static class RoleSchemaConstants { public static final String TYPE_DESC = "A label indicating the type of resource, e.g. 'User' or 'Group'"; public static final String AUDIENCE_TYPE_DESC = "A label indicating the resource type of the role's usable audience."; + public static final String ROLE_PROPERTY_NAME_DESC = "Name of the role property."; + public static final String ROLE_PROPERTY_VALUE_DESC = "Value of the role property."; + public static final String ROLE_PROPERTIES_DESC = "A list of properties of the role."; // URIs of sub and multivalued attributes. public static final String USERS_VALUE_URI = "urn:ietf:params:scim:schemas:extension:2.0:Role:users.value"; @@ -612,6 +619,11 @@ public static class RoleSchemaConstants { public static final String AUDIENCE_DISPLAY_URI = "urn:ietf:params:scim:schemas:extension:2.0:Role:audience.display"; public static final String AUDIENCE_TYPE_URI = "urn:ietf:params:scim:schemas:extension:2.0:Role:audience.type"; + public static final String ROLE_PROPERTY_NAME_URI = + "urn:ietf:params:scim:schemas:extension:2.0:Role:roleProperties.name"; + public static final String ROLE_PROPERTY_VALUE_URI = + "urn:ietf:params:scim:schemas:extension:2.0:Role:roleProperties.value"; + } /** diff --git a/modules/charon-core/src/main/java/org/wso2/charon3/core/schema/SCIMSchemaDefinitions.java b/modules/charon-core/src/main/java/org/wso2/charon3/core/schema/SCIMSchemaDefinitions.java index 586486019..0331259e0 100644 --- a/modules/charon-core/src/main/java/org/wso2/charon3/core/schema/SCIMSchemaDefinitions.java +++ b/modules/charon-core/src/main/java/org/wso2/charon3/core/schema/SCIMSchemaDefinitions.java @@ -1141,6 +1141,21 @@ public static class SCIMRoleSchemaDefinition { Arrays.asList(SCIMConstants.RoleSchemaConstants.APPLICATION, SCIMConstants.RoleSchemaConstants.ORGANIZATION)), null, null); + public static final SCIMAttributeSchema ROLE_V2_PROPERTY_NAME = + SCIMAttributeSchema.createSCIMAttributeSchema(SCIMConstants.RoleSchemaConstants.ROLE_PROPERTY_NAME_URI, + SCIMConstants.RoleSchemaConstants.ROLE_PROPERTY_NAME, SCIMDefinitions.DataType.STRING, false, + SCIMConstants.RoleSchemaConstants.ROLE_PROPERTY_NAME_DESC, false, false, + SCIMDefinitions.Mutability.IMMUTABLE, SCIMDefinitions.Returned.DEFAULT, + SCIMDefinitions.Uniqueness.NONE, null, null, null); + + public static final SCIMAttributeSchema ROLE_V2_PROPERTY_VALUE = + SCIMAttributeSchema.createSCIMAttributeSchema( + SCIMConstants.RoleSchemaConstants.ROLE_PROPERTY_VALUE_URI, + SCIMConstants.RoleSchemaConstants.VALUE, SCIMDefinitions.DataType.STRING, false, + SCIMConstants.RoleSchemaConstants.ROLE_PROPERTY_VALUE_DESC, false, false, + SCIMDefinitions.Mutability.IMMUTABLE, SCIMDefinitions.Returned.DEFAULT, + SCIMDefinitions.Uniqueness.NONE, null, null, null); + // Attribute schemas of the attributes defined in role schema. // A human-readable name for the Role. REQUIRED. @@ -1207,6 +1222,14 @@ public static class SCIMRoleSchemaDefinition { SCIMDefinitions.Mutability.READ_ONLY, SCIMDefinitions.Returned.DEFAULT, SCIMDefinitions.Uniqueness.NONE, null, null, new ArrayList<>( Arrays.asList(ASC_APPLICATIONS_VALUE, ASC_APPLICATIONS_DISPLAY, ASC_APPLICATIONS_REF))); + + public static final SCIMAttributeSchema ROLE_V2_PROPERTIES = + SCIMAttributeSchema.createSCIMAttributeSchema(SCIMConstants.RoleSchemaConstants.ROLE_PROPERTIES_URI, + SCIMConstants.RoleSchemaConstants.ROLE_PROPERTIES, SCIMDefinitions.DataType.COMPLEX, true, + SCIMConstants.RoleSchemaConstants.ROLE_PROPERTIES_DESC, false, false, + SCIMDefinitions.Mutability.READ_ONLY, SCIMDefinitions.Returned.DEFAULT, + SCIMDefinitions.Uniqueness.NONE, null, null, new ArrayList<>( + Arrays.asList(ROLE_V2_PROPERTY_NAME, ROLE_V2_PROPERTY_VALUE))); } /**