Skip to content

Commit

Permalink
Create complex object to store role properties
Browse files Browse the repository at this point in the history
  • Loading branch information
ShanChathusanda93 committed Dec 12, 2024
1 parent f394957 commit fbdb315
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,34 @@ public void setAssociatedApplications(List<MultiValuedComplexType> associatedApp
displayDefinition, null, null, refDefinition);
}

/**
* Set the role properties of the role.
*
* @param rolePropertiesList List of role properties.
*/
public void setRoleProperties(List<MultiValuedComplexType> 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<MultiValuedComplexType> 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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 PROPERTIES_URI =
"urn:ietf:params:scim:schemas:extension:2.0:Role:properties";
public static final String PROPERTIES = "properties";
public static final String PROPERTY_NAME = "name";

// Possible canonical values for audience type attribute.
public static final String APPLICATION = "application";
Expand Down Expand Up @@ -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 PROPERTY_NAME_DESC = "Name of the role property.";
public static final String PROPERTY_VALUE_DESC = "Value of the role property.";
public static final String 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";
Expand Down Expand Up @@ -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 PROPERTIES_NAME_URI =
"urn:ietf:params:scim:schemas:extension:2.0:Role:properties.name";
public static final String PROPERTY_VALUE_URI =
"urn:ietf:params:scim:schemas:extension:2.0:Role:properties.value";

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,23 @@ public static class SCIMRoleSchemaDefinition {
Arrays.asList(SCIMConstants.RoleSchemaConstants.APPLICATION,
SCIMConstants.RoleSchemaConstants.ORGANIZATION)), null, null);

// Name of the property of the role.
public static final SCIMAttributeSchema ROLE_V2_PROPERTY_NAME =
SCIMAttributeSchema.createSCIMAttributeSchema(SCIMConstants.RoleSchemaConstants.PROPERTIES_NAME_URI,
SCIMConstants.RoleSchemaConstants.PROPERTY_NAME, SCIMDefinitions.DataType.STRING, false,
SCIMConstants.RoleSchemaConstants.PROPERTY_NAME_DESC, false, false,
SCIMDefinitions.Mutability.IMMUTABLE, SCIMDefinitions.Returned.DEFAULT,
SCIMDefinitions.Uniqueness.SERVER, null, null, null);

// Value of the property of the role.
public static final SCIMAttributeSchema ROLE_V2_PROPERTY_VALUE =
SCIMAttributeSchema.createSCIMAttributeSchema(
SCIMConstants.RoleSchemaConstants.PROPERTY_VALUE_URI,
SCIMConstants.RoleSchemaConstants.VALUE, SCIMDefinitions.DataType.STRING, false,
SCIMConstants.RoleSchemaConstants.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.
Expand Down Expand Up @@ -1207,6 +1224,15 @@ 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)));

// A list of properties of the Role.
public static final SCIMAttributeSchema ROLE_V2_PROPERTIES =
SCIMAttributeSchema.createSCIMAttributeSchema(SCIMConstants.RoleSchemaConstants.PROPERTIES_URI,
SCIMConstants.RoleSchemaConstants.PROPERTIES, SCIMDefinitions.DataType.COMPLEX, true,
SCIMConstants.RoleSchemaConstants.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)));
}

/**
Expand Down Expand Up @@ -1614,7 +1640,8 @@ public static class SCIMResourceTypeSchemaDefinition {
SCIMRoleSchemaDefinition.USERS,
SCIMRoleSchemaDefinition.GROUPS,
SCIMRoleSchemaDefinition.ROLE_V2_PERMISSIONS,
SCIMRoleSchemaDefinition.ASSOCIATED_APPLICATIONS);
SCIMRoleSchemaDefinition.ASSOCIATED_APPLICATIONS,
SCIMRoleSchemaDefinition.ROLE_V2_PROPERTIES);

/*
* **********SCIM defined Service Provider Config Resource Schema.****************************
Expand Down

0 comments on commit fbdb315

Please sign in to comment.