Skip to content

Commit

Permalink
Set user store domain
Browse files Browse the repository at this point in the history
  • Loading branch information
chamilaadhi committed Feb 29, 2024
1 parent 6d84775 commit 99c4044
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class RegistrationProfile {
private boolean saasApp;
private String audience;
private String tokenType;
private boolean userstoreDomainInSubject;

public String getRecepientValidationURL() {
return recepientValidationURL;
Expand Down Expand Up @@ -215,4 +216,12 @@ public void setTokenType(String tokenType) {
this.tokenType = tokenType;
}

public boolean isUserStoreDomainInSubject() {
return userstoreDomainInSubject;
}

public void setUserStoreDomainInSubject(boolean setUserStoreDomainInSubject) {
this.userstoreDomainInSubject = setUserStoreDomainInSubject;
}

Check warning on line 225 in components/apimgt/org.wso2.carbon.apimgt.rest.api.dcr/src/main/java/org/wso2/carbon/apimgt/rest/api/dcr/web/dto/RegistrationProfile.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.rest.api.dcr/src/main/java/org/wso2/carbon/apimgt/rest/api/dcr/web/dto/RegistrationProfile.java#L224-L225

Added lines #L224 - L225 were not covered by tests

}
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ public Response register(RegistrationProfile profile) {
returnedAPP = this.getExistingApp(applicationName, appServiceProvider.isSaasApp());
} else {
//create a new application if the application doesn't exists.
returnedAPP = this.createApplication(applicationName, appRequest, grantTypes);
returnedAPP = this.createApplication(applicationName, appRequest, grantTypes,
profile.isUserStoreDomainInSubject());
}
//ReturnedAPP is null
if (returnedAPP == null) {
Expand Down Expand Up @@ -278,8 +279,8 @@ private OAuthApplicationInfo getExistingApp(String applicationName, boolean saas
* @return created Application
* @throws APIManagementException if failed to create the new application
*/
private OAuthApplicationInfo createApplication(String applicationName, OAuthAppRequest appRequest,
String grantType) throws APIManagementException {
private OAuthApplicationInfo createApplication(String applicationName, OAuthAppRequest appRequest, String grantType,
boolean setUserStoreDomainInSubject) throws APIManagementException {
String userName;
OAuthApplicationInfo applicationInfo = appRequest.getOAuthApplicationInfo();
String appName = applicationInfo.getClientName();
Expand Down Expand Up @@ -325,6 +326,12 @@ private OAuthApplicationInfo createApplication(String applicationName, OAuthAppR
logoutConsentProperty.setName(APIConstants.APP_SKIP_LOGOUT_CONSENT_NAME);
logoutConsentProperty.setValue(APIConstants.APP_SKIP_LOGOUT_CONSENT_VALUE);
serviceProviderProperties.add(logoutConsentProperty);

if (setUserStoreDomainInSubject) {
LocalAndOutboundAuthenticationConfig localAndOutboundConfig = new LocalAndOutboundAuthenticationConfig();
localAndOutboundConfig.setUseUserstoreDomainInLocalSubjectIdentifier(true);

Check warning on line 332 in components/apimgt/org.wso2.carbon.apimgt.rest.api.dcr/src/main/java/org/wso2/carbon/apimgt/rest/api/dcr/web/impl/RegistrationServiceImpl.java

View check run for this annotation

Codecov / codecov/patch

components/apimgt/org.wso2.carbon.apimgt.rest.api.dcr/src/main/java/org/wso2/carbon/apimgt/rest/api/dcr/web/impl/RegistrationServiceImpl.java#L331-L332

Added lines #L331 - L332 were not covered by tests
serviceProvider.setLocalAndOutBoundAuthenticationConfig(localAndOutboundConfig);
}

String orgId = null;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ components:
type: string
readOnly: true
example: JWT
userstoreDomainInSubject:
type: string
readOnly: true
example: true
DCRResult:
title: DCRResult
type: object
Expand Down

0 comments on commit 99c4044

Please sign in to comment.