Skip to content

Commit

Permalink
Merge branch 'master' into add-password-expiry-API
Browse files Browse the repository at this point in the history
  • Loading branch information
Thisara-Welmilla authored Sep 5, 2023
2 parents a1b00e5 + 7ff49a2 commit 2b54811
Show file tree
Hide file tree
Showing 100 changed files with 687 additions and 154 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.idle.account.identification</artifactId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.idle.account.identification</artifactId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>org.wso2.carbon.identity.api.server.admin.advisory.management</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>org.wso2.carbon.identity.api.server.admin.advisory.management</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.application.management</artifactId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.application.management.common</artifactId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
<packaging>jar</packaging>

<dependencies>
Expand Down Expand Up @@ -57,7 +57,7 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.security.mgt</groupId>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>org.wso2.carbon.security.mgt</artifactId>
<scope>provided</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.application.management</artifactId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<name>WSO2 Identity Server - Applications Rest API</name>
<description>WSO2 Identity Server - Applications Rest API</description>
<artifactId>org.wso2.carbon.identity.api.server.application.management.v1</artifactId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
<packaging>jar</packaging>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package org.wso2.carbon.identity.api.server.application.management.v1.core;

import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.introspector.Property;
import org.yaml.snakeyaml.representer.Representer;

Expand All @@ -33,6 +34,10 @@ public class CustomRepresenter extends Representer {
private static final String[] PROPERTIES_TO_REMOVE = {"inboundConfiguration", "applicationID", "owner",
"tenantDomain", "id", "idpProperties", "resourceId", "spProperties", "applicationResourceId"};

public CustomRepresenter(DumperOptions options) {
super(options);
}

@Override
protected Set<Property> getProperties(Class<?> type) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@
import org.wso2.carbon.identity.template.mgt.model.Template;
import org.wso2.carbon.user.core.common.AbstractUserStoreManager;
import org.wso2.carbon.user.core.service.RealmService;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.TypeDescription;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;
Expand Down Expand Up @@ -551,8 +553,8 @@ public void beforeMarshal(Object source) {

private String parseYamlFromServiceProvider(ServiceProvider serviceProvider) {

Constructor constructor = new Constructor();
CustomRepresenter representer = new CustomRepresenter();
Constructor constructor = new Constructor(new LoaderOptions());
CustomRepresenter representer = new CustomRepresenter(new DumperOptions());

for (Class<?> protocol : INBOUND_CONFIG_PROTOCOLS) {
TypeDescription description = new TypeDescription(InboundConfigurationProtocol.class);
Expand Down Expand Up @@ -684,7 +686,7 @@ private ServiceProvider parseServiceProviderFromYaml(SpFileContent spFileContent
throws IdentityApplicationManagementException {

try {
Yaml yaml = new Yaml(new Constructor(ServiceProvider.class));
Yaml yaml = new Yaml(new Constructor(ServiceProvider.class, new LoaderOptions()));
return yaml.loadAs(spFileContent.getContent(), ServiceProvider.class);
} catch (YAMLException e) {
throw new IdentityApplicationManagementException(String.format("Error in reading YAML Service Provider " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public class ServiceProviderToApiModel implements Function<ServiceProvider, Appl
private static final Set<String> systemApplications = ApplicationManagementServiceHolder
.getApplicationManagementService().getSystemApplications();
private static final String IS_FRAGMENT_APP = "isFragmentApp";
private static final String useUserIdForDefaultSubject = "useUserIdForDefaultSubject";

@Override
public ApplicationResponseModel apply(ServiceProvider application) {
Expand Down Expand Up @@ -283,9 +284,7 @@ private SubjectConfig buildSubjectClaimConfig(ServiceProvider application) {
subjectConfig.includeUserDomain(localAndOutboundAuthConfig.isUseUserstoreDomainInLocalSubjectIdentifier());

if (StringUtils.isBlank(localAndOutboundAuthConfig.getSubjectClaimUri())) {
if (isLocalClaimDialectUsedBySp(application)) {
subjectConfig.claim(buildClaimModel(FrameworkConstants.USERNAME_CLAIM));
}
assignClaimForSubjectValue(application, subjectConfig);
} else {
subjectConfig.claim(buildClaimModel(localAndOutboundAuthConfig.getSubjectClaimUri()));
}
Expand All @@ -294,6 +293,27 @@ private SubjectConfig buildSubjectClaimConfig(ServiceProvider application) {
return subjectConfig;
}

private void assignClaimForSubjectValue(ServiceProvider application, SubjectConfig subjectConfig) {

if (isLocalClaimDialectUsedBySp(application)) {
if (isUserIdUsedAsDefaultSubject(application.getSpProperties())) {
subjectConfig.claim(buildClaimModel(FrameworkConstants.USER_ID_CLAIM));
} else {
subjectConfig.claim(buildClaimModel(FrameworkConstants.USERNAME_CLAIM));
}
}
}

private boolean isUserIdUsedAsDefaultSubject (ServiceProviderProperty[] spProperties) {

for (ServiceProviderProperty spProperty : spProperties) {
if (useUserIdForDefaultSubject.equals(spProperty.getName())) {
return true;
}
}
return false;
}

private ClaimConfiguration.DialectEnum getDialect(ServiceProvider application) {

if (isLocalClaimDialectUsedBySp(application)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
<parent>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.application.management</artifactId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
<packaging>pom</packaging>

<modules>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.authenticators</artifactId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.authenticators.common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.authenticators</artifactId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.authenticators.v1</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.branding.preference.management</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
</parent>

<groupId>org.wso2.carbon.identity.server.api</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<artifactId>org.wso2.carbon.identity.api.server.branding.preference.management</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<relativePath>../pom.xml</relativePath>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<artifactId>org.wso2.carbon.identity.api.server.challenge</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<relativePath>../pom.xml</relativePath>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.identity.api.server.challenge.common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.challenge</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.identity.rest.api.server.challenge.v1</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<artifactId>org.wso2.carbon.identity.api.server.claim.management</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<relativePath>../pom.xml</relativePath>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.identity.api.server.claim.management.common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.claim.management</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.identity.rest.api.server.claim.management.v1</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
import org.wso2.carbon.user.api.UserStoreException;
import org.wso2.carbon.user.core.UserStoreManager;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;
import org.yaml.snakeyaml.error.YAMLException;
Expand Down Expand Up @@ -1154,7 +1155,7 @@ private ClaimDialectConfiguration parseClaimDialectFromJson(FileContent fileCont
private ClaimDialectConfiguration parseClaimDialectFromYaml(FileContent fileContent) throws ClaimMetadataException {

try {
Yaml yaml = new Yaml(new Constructor(ClaimDialectConfiguration.class));
Yaml yaml = new Yaml(new Constructor(ClaimDialectConfiguration.class, new LoaderOptions()));
return yaml.loadAs(fileContent.getContent(), ClaimDialectConfiguration.class);
} catch (YAMLException e) {
throw new ClaimMetadataException(String.format(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.configs</artifactId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.configs.common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.configs</artifactId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.configs.v1</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.cors</artifactId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.cors.common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.cors</artifactId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.cors.v1</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.71-SNAPSHOT</version>
<version>1.2.76-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Loading

0 comments on commit 2b54811

Please sign in to comment.