Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide support for attribute profiles #767

Merged
merged 10 commits into from
Jan 21, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -284,4 +284,5 @@ public String toString() {
public static final String PROP_REQUIRED = "Required";
public static final String PROP_SUPPORTED_BY_DEFAULT = "SupportedByDefault";
public static final String PROP_UNIQUENESS_SCOPE = "UniquenessScope";
public static final String PROP_PROFILES_PREFIX = "Profiles.";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.wso2.carbon.identity.rest.api.server.claim.management.v1.dto;

import io.swagger.annotations.*;
import com.fasterxml.jackson.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@ApiModel(description = "Attribute profile.")
public class AttributeProfileDTO {

@Valid
private Boolean readOnly = null;

@Valid
private Boolean required = null;

@Valid
private Boolean supportedByDefault = null;

/**
**/
@ApiModelProperty(value = "Specifies if the claim is read-only in given profile.")
@JsonProperty("readOnly")
public Boolean getReadOnly() {
return readOnly;
}
public void setReadOnly(Boolean readOnly) {
this.readOnly = readOnly;
}

/**
**/
@ApiModelProperty(value = "Specifies if the claim is required in given profile.")
@JsonProperty("required")
public Boolean getRequired() {
return required;
}
public void setRequired(Boolean required) {
this.required = required;
}

/**
**/
@ApiModelProperty(value = "Specifies if the claim will be displayed on the given profile.")
@JsonProperty("supportedByDefault")
public Boolean getSupportedByDefault() {
return supportedByDefault;
}
public void setSupportedByDefault(Boolean supportedByDefault) {
this.supportedByDefault = supportedByDefault;
}

@Override
public String toString() {

StringBuilder sb = new StringBuilder();
sb.append("class AttributeProfileDTO {\n");

sb.append(" readOnly: ").append(readOnly).append("\n");
sb.append(" required: ").append(required).append("\n");
sb.append(" supportedByDefault: ").append(supportedByDefault).append("\n");

sb.append("}\n");
return sb.toString();
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
/*
* Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* Copyright (c) 2021-2025, WSO2 LLC. (http://www.wso2.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.wso2.carbon.identity.rest.api.server.claim.management.v1.dto;
Expand All @@ -20,6 +22,7 @@
import java.util.ArrayList;
import java.util.List;
import org.wso2.carbon.identity.rest.api.server.claim.management.v1.dto.AttributeMappingDTO;
import org.wso2.carbon.identity.rest.api.server.claim.management.v1.dto.ProfilesDTO;
import org.wso2.carbon.identity.rest.api.server.claim.management.v1.dto.PropertyDTO;
import io.swagger.annotations.*;
import com.fasterxml.jackson.annotation.*;
Expand Down Expand Up @@ -80,6 +83,9 @@ public enum SharedProfileValueResolvingMethodEnum {
@Valid
private List<PropertyDTO> properties = new ArrayList<PropertyDTO>();

@Valid
private ProfilesDTO profiles = null;

/**
* A unique URI specific to the claim.
**/
Expand Down Expand Up @@ -226,6 +232,17 @@ public void setProperties(List<PropertyDTO> properties) {
this.properties = properties;
}

/**
**/
@ApiModelProperty(value = "Define any attribute profiles.")
@JsonProperty("profiles")
public ProfilesDTO getProfiles() {
return profiles;
}
public void setProfiles(ProfilesDTO profiles) {
this.profiles = profiles;
}

@Override
public String toString() {

Expand All @@ -244,6 +261,7 @@ public String toString() {
sb.append(" sharedProfileValueResolvingMethod: ").append(sharedProfileValueResolvingMethod).append("\n");
sb.append(" attributeMapping: ").append(attributeMapping).append("\n");
sb.append(" properties: ").append(properties).append("\n");
sb.append(" profiles: ").append(profiles).append("\n");

sb.append("}\n");
return sb.toString();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
/*
* Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* Copyright (c) 2021-2025, WSO2 LLC. (http://www.wso2.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.wso2.carbon.identity.rest.api.server.claim.management.v1.dto;
Expand All @@ -21,6 +23,7 @@
import java.util.List;
import org.wso2.carbon.identity.rest.api.server.claim.management.v1.dto.AttributeMappingDTO;
import org.wso2.carbon.identity.rest.api.server.claim.management.v1.dto.ClaimResDTO;
import org.wso2.carbon.identity.rest.api.server.claim.management.v1.dto.ProfilesDTO;
import org.wso2.carbon.identity.rest.api.server.claim.management.v1.dto.PropertyDTO;
import io.swagger.annotations.*;
import com.fasterxml.jackson.annotation.*;
Expand Down Expand Up @@ -83,6 +86,9 @@ public enum SharedProfileValueResolvingMethodEnum {
@Valid
private List<PropertyDTO> properties = new ArrayList<PropertyDTO>();

@Valid
private ProfilesDTO profiles = null;

/**
* claim ID.
**/
Expand Down Expand Up @@ -253,6 +259,18 @@ public void setProperties(List<PropertyDTO> properties) {
this.properties = properties;
}

/**
* Define attribute profiles.
**/
@ApiModelProperty(value = "Define any attribute profiles.")
@JsonProperty("profiles")
public ProfilesDTO getProfiles() {
return profiles;
}
public void setProfiles(ProfilesDTO profiles) {
this.profiles = profiles;
}

@Override
public String toString() {

Expand All @@ -274,6 +292,7 @@ public String toString() {
sb.append(" sharedProfileValueResolvingMethod: ").append(sharedProfileValueResolvingMethod).append("\n");
sb.append(" attributeMapping: ").append(attributeMapping).append("\n");
sb.append(" properties: ").append(properties).append("\n");
sb.append(" profiles: ").append(profiles).append("\n");

sb.append("}\n");
return sb.toString();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.wso2.carbon.identity.rest.api.server.claim.management.v1.dto;

import io.swagger.annotations.ApiModel;
import java.util.HashMap;
import java.util.Map;
import org.wso2.carbon.identity.rest.api.server.claim.management.v1.dto.AttributeProfileDTO;
import io.swagger.annotations.*;
import com.fasterxml.jackson.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
* Attribute profiles.
**/
@ApiModel(description = "Attribute profiles.")
public class ProfilesDTO extends HashMap<String, AttributeProfileDTO> {

private static final long serialVersionUID = -227086223053735979L;

@Override
public String toString() {

StringBuilder sb = new StringBuilder();
sb.append("class ProfilesDTO {\n");
sb.append(" " + super.toString()).append("\n");


sb.append("}\n");
return sb.toString();
}
}
Loading
Loading