Skip to content

Commit

Permalink
support ref in permission and assoc applications
Browse files Browse the repository at this point in the history
  • Loading branch information
AnuradhaSK committed Oct 21, 2023
1 parent 1d4873a commit c0b8126
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,11 @@ public List<String> getPermissionDisplayNames() {
public List<MultiValuedComplexType> getPermissions() {

SCIMAttributeSchema complexDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.ROLE_V2_PERMISSIONS;
SCIMAttributeSchema valueDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.PERMISSION_VALUE;
SCIMAttributeSchema displayDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.PERMISSION_DISPLAY;
SCIMAttributeSchema valueDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.PERMISSIONS_VALUE;
SCIMAttributeSchema displayDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.PERMISSIONS_DISPLAY;
SCIMAttributeSchema refDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.PERMISSIONS_REF;
return getMultivaluedComplexType(complexDefinition, valueDefinition, displayDefinition, null, null,
null).orElse(Collections.emptyList());
refDefinition).orElse(Collections.emptyList());
}

/**
Expand All @@ -438,10 +439,11 @@ public List<MultiValuedComplexType> getPermissions() {
public void setPermissions(List<MultiValuedComplexType> permissionsList) {

SCIMAttributeSchema complexDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.ROLE_V2_PERMISSIONS;
SCIMAttributeSchema valueDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.PERMISSION_VALUE;
SCIMAttributeSchema displayDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.PERMISSION_DISPLAY;
SCIMAttributeSchema valueDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.PERMISSIONS_VALUE;
SCIMAttributeSchema displayDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.PERMISSIONS_DISPLAY;
SCIMAttributeSchema refDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.PERMISSIONS_REF;
addMultivaluedComplexAtribute(permissionsList, complexDefinition, valueDefinition, displayDefinition,
null, null, null);
null, null, refDefinition);
}

/**
Expand Down Expand Up @@ -506,10 +508,11 @@ public List<String> getAssociatedApplicationDisplayNames() {
public List<MultiValuedComplexType> getAssociatedApplications() {

SCIMAttributeSchema complexDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.ASSOCIATED_APPLICATIONS;
SCIMAttributeSchema valueDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.ASC_APPLICATION_VALUE;
SCIMAttributeSchema displayDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.ASC_APPLICATION_DISPLAY;
SCIMAttributeSchema valueDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.ASC_APPLICATIONS_VALUE;
SCIMAttributeSchema displayDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.ASC_APPLICATIONS_DISPLAY;
SCIMAttributeSchema refDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.ASC_APPLICATIONS_REF;
return getMultivaluedComplexType(complexDefinition, valueDefinition, displayDefinition, null, null,
null).orElse(Collections.emptyList());
refDefinition).orElse(Collections.emptyList());
}

/**
Expand All @@ -518,10 +521,11 @@ public List<MultiValuedComplexType> getAssociatedApplications() {
public void setAssociatedApplications(List<MultiValuedComplexType> associatedApplicationsList) {

SCIMAttributeSchema complexDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.ASSOCIATED_APPLICATIONS;
SCIMAttributeSchema valueDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.ASC_APPLICATION_VALUE;
SCIMAttributeSchema displayDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.ASC_APPLICATION_DISPLAY;
SCIMAttributeSchema valueDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.ASC_APPLICATIONS_VALUE;
SCIMAttributeSchema displayDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.ASC_APPLICATIONS_DISPLAY;
SCIMAttributeSchema refDefinition = SCIMSchemaDefinitions.SCIMRoleSchemaDefinition.ASC_APPLICATIONS_REF;
addMultivaluedComplexAtribute(associatedApplicationsList, complexDefinition, valueDefinition,
displayDefinition, null, null, null);
displayDefinition, null, null, refDefinition);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,9 @@ public static class RoleSchemaConstants {
"The uri corresponding to a SCIM resource that is a user of this Role.";
public static final String GROUPS_REF_DESC =
"The uri corresponding to a SCIM resource that is a group of this Role.";
public static final String PERMISSIONS_REF_DESC = "The uri corresponding to permission resource of this Role.";
public static final String ASC_APPLICATIONS_REF_DESC =
"The uri corresponding to associated application resource of this Role.";
public static final String USERS_DISPLAY_DESC = "A human-readable name for the user.";
public static final String GROUPS_DISPLAY_DESC = "A human-readable name for the group.";
public static final String PERMISSIONS_DISPLAY_DESC = "A human-readable name for the permission.";
Expand All @@ -595,10 +598,14 @@ public static class RoleSchemaConstants {
"urn:ietf:params:scim:schemas:extension:2.0:Role:permissions.value";
public static final String PERMISSIONS_DISPLAY_URI =
"urn:ietf:params:scim:schemas:extension:2.0:Role:permissions.display";
public static final String ASC_APPLICATION_VALUE_URI =
public static final String PERMISSIONS_REF_URI =
"urn:ietf:params:scim:schemas:extension:2.0:Role:permissions.$ref";
public static final String ASC_APPLICATIONS_VALUE_URI =
"urn:ietf:params:scim:schemas:extension:2.0:Role:associatedApplications.value";
public static final String ASC_APPLICATION_DISPLAY_URI =
public static final String ASC_APPLICATIONS_DISPLAY_URI =
"urn:ietf:params:scim:schemas:extension:2.0:Role:associatedApplications.display";
public static final String ASC_APPLICATIONS_REF_URI =
"urn:ietf:params:scim:schemas:extension:2.0:Role:associatedApplications.$ref";
public static final String AUDIENCE_VALUE_URI =
"urn:ietf:params:scim:schemas:extension:2.0:Role:audience.value";
public static final String AUDIENCE_DISPLAY_URI =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1065,39 +1065,56 @@ public static class SCIMRoleSchemaDefinition {
SCIMDefinitions.Uniqueness.NONE, null, null, null);

// Identifier of the permission of this Role.
public static final SCIMAttributeSchema PERMISSION_VALUE =
public static final SCIMAttributeSchema PERMISSIONS_VALUE =
SCIMAttributeSchema.createSCIMAttributeSchema(SCIMConstants.RoleSchemaConstants.PERMISSIONS_VALUE_URI,
SCIMConstants.RoleSchemaConstants.VALUE, SCIMDefinitions.DataType.STRING, false,
SCIMConstants.RoleSchemaConstants.PERMISSIONS_VALUE_DESC, false, false,
SCIMDefinitions.Mutability.IMMUTABLE, SCIMDefinitions.Returned.DEFAULT,
SCIMDefinitions.Uniqueness.NONE, null, null, null);

// A human-readable name of the permission of this Role.
public static final SCIMAttributeSchema PERMISSION_DISPLAY =
public static final SCIMAttributeSchema PERMISSIONS_DISPLAY =
SCIMAttributeSchema.createSCIMAttributeSchema(SCIMConstants.RoleSchemaConstants.PERMISSIONS_DISPLAY_URI,
SCIMConstants.RoleSchemaConstants.DISPLAY, SCIMDefinitions.DataType.STRING, false,
SCIMConstants.RoleSchemaConstants.PERMISSIONS_DISPLAY_DESC, false, false,
SCIMDefinitions.Mutability.IMMUTABLE, SCIMDefinitions.Returned.DEFAULT,
SCIMDefinitions.Uniqueness.NONE, null, null, null);

// The uri corresponding to permission of a Role.
public static final SCIMAttributeSchema PERMISSIONS_REF =
SCIMAttributeSchema.createSCIMAttributeSchema(SCIMConstants.RoleSchemaConstants.PERMISSIONS_REF_URI,
SCIMConstants.CommonSchemaConstants.REF, SCIMDefinitions.DataType.REFERENCE, false,
SCIMConstants.RoleSchemaConstants.PERMISSIONS_REF_DESC, false, false,
SCIMDefinitions.Mutability.IMMUTABLE, SCIMDefinitions.Returned.DEFAULT,
SCIMDefinitions.Uniqueness.NONE, null,
new ArrayList<>(Arrays.asList(SCIMDefinitions.ReferenceType.URI)), null);

// Identifier of the associated application of this Role.
public static final SCIMAttributeSchema ASC_APPLICATION_VALUE =
public static final SCIMAttributeSchema ASC_APPLICATIONS_VALUE =
SCIMAttributeSchema.createSCIMAttributeSchema(
SCIMConstants.RoleSchemaConstants.ASC_APPLICATION_VALUE_URI,
SCIMConstants.RoleSchemaConstants.ASC_APPLICATIONS_VALUE_URI,
SCIMConstants.RoleSchemaConstants.VALUE, SCIMDefinitions.DataType.STRING, false,
SCIMConstants.RoleSchemaConstants.ASC_APPLICATIONS_VALUE_DESC, false, false,
SCIMDefinitions.Mutability.IMMUTABLE, SCIMDefinitions.Returned.DEFAULT,
SCIMDefinitions.Uniqueness.NONE, null, null, null);

// A human-readable name of the associated application of this Role.
public static final SCIMAttributeSchema ASC_APPLICATION_DISPLAY =
public static final SCIMAttributeSchema ASC_APPLICATIONS_DISPLAY =
SCIMAttributeSchema.createSCIMAttributeSchema(
SCIMConstants.RoleSchemaConstants.ASC_APPLICATION_DISPLAY_URI,
SCIMConstants.RoleSchemaConstants.ASC_APPLICATIONS_DISPLAY_URI,
SCIMConstants.RoleSchemaConstants.DISPLAY, SCIMDefinitions.DataType.STRING, false,
SCIMConstants.RoleSchemaConstants.ASC_APPLICATIONS_DISPLAY_DESC, false, false,
SCIMDefinitions.Mutability.IMMUTABLE, SCIMDefinitions.Returned.DEFAULT,
SCIMDefinitions.Uniqueness.NONE, null, null, null);

// The uri corresponding to an associated application of this Role.
public static final SCIMAttributeSchema ASC_APPLICATIONS_REF = SCIMAttributeSchema.createSCIMAttributeSchema(
SCIMConstants.RoleSchemaConstants.ASC_APPLICATIONS_REF_URI, SCIMConstants.CommonSchemaConstants.REF,
SCIMDefinitions.DataType.REFERENCE, false, SCIMConstants.RoleSchemaConstants.ASC_APPLICATIONS_REF_DESC,
false, false, SCIMDefinitions.Mutability.IMMUTABLE, SCIMDefinitions.Returned.DEFAULT,
SCIMDefinitions.Uniqueness.NONE, null,
new ArrayList<>(Arrays.asList(SCIMDefinitions.ReferenceType.URI)), null);

// Identifier of the role's audience.
public static final SCIMAttributeSchema AUDIENCE_VALUE =
SCIMAttributeSchema.createSCIMAttributeSchema(SCIMConstants.RoleSchemaConstants.AUDIENCE_VALUE_URI,
Expand Down Expand Up @@ -1180,16 +1197,16 @@ public static class SCIMRoleSchemaDefinition {
SCIMConstants.RoleSchemaConstants.PERMISSIONS_DESC, false, false,
SCIMDefinitions.Mutability.READ_WRITE, SCIMDefinitions.Returned.DEFAULT,
SCIMDefinitions.Uniqueness.NONE, null, null,
new ArrayList<>(Arrays.asList(PERMISSION_VALUE, PERMISSION_DISPLAY)));
new ArrayList<>(Arrays.asList(PERMISSIONS_VALUE, PERMISSIONS_DISPLAY, PERMISSIONS_REF)));

// A list of associated applications of the Role.
public static final SCIMAttributeSchema ASSOCIATED_APPLICATIONS =
SCIMAttributeSchema.createSCIMAttributeSchema(SCIMConstants.RoleSchemaConstants.ASC_APPLICATIONS_URI,
SCIMConstants.RoleSchemaConstants.ASC_APPLICATIONS, SCIMDefinitions.DataType.COMPLEX, true,
SCIMConstants.RoleSchemaConstants.ASC_APPLICATIONS_DESC, false, false,
SCIMDefinitions.Mutability.READ_ONLY, SCIMDefinitions.Returned.DEFAULT,
SCIMDefinitions.Uniqueness.NONE, null, null,
new ArrayList<>(Arrays.asList(ASC_APPLICATION_VALUE, ASC_APPLICATION_DISPLAY)));
SCIMDefinitions.Uniqueness.NONE, null, null, new ArrayList<>(
Arrays.asList(ASC_APPLICATIONS_VALUE, ASC_APPLICATIONS_DISPLAY, ASC_APPLICATIONS_REF)));
}

/**
Expand Down

0 comments on commit c0b8126

Please sign in to comment.