Skip to content

Commit 0126f51

Browse files
committed
support tenant domain append for local subject identifier for JWT system APPs.
1 parent 88f4c47 commit 0126f51

File tree

1 file changed

+18
-9
lines changed
  • components/apimgt/org.wso2.carbon.apimgt.rest.api.dcr/src/main/java/org/wso2/carbon/apimgt/rest/api/dcr/web/impl

1 file changed

+18
-9
lines changed

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

+18-9
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,17 @@
2727
import org.wso2.carbon.apimgt.api.model.OAuthApplicationInfo;
2828
import org.wso2.carbon.apimgt.impl.APIConstants;
2929
import org.wso2.carbon.apimgt.rest.api.common.RestApiCommonUtil;
30+
import org.wso2.carbon.apimgt.rest.api.common.RestApiConstants;
31+
import org.wso2.carbon.apimgt.rest.api.common.dto.ErrorDTO;
3032
import org.wso2.carbon.apimgt.rest.api.dcr.web.RegistrationService;
3133
import org.wso2.carbon.apimgt.rest.api.dcr.web.dto.FaultResponse;
3234
import org.wso2.carbon.apimgt.rest.api.dcr.web.dto.RegistrationProfile;
33-
import org.wso2.carbon.apimgt.rest.api.common.RestApiConstants;
34-
import org.wso2.carbon.apimgt.rest.api.common.dto.ErrorDTO;
3535
import org.wso2.carbon.apimgt.rest.api.util.utils.RestApiUtil;
3636
import org.wso2.carbon.context.PrivilegedCarbonContext;
3737
import org.wso2.carbon.identity.application.common.IdentityApplicationManagementException;
3838
import org.wso2.carbon.identity.application.common.model.InboundAuthenticationConfig;
3939
import org.wso2.carbon.identity.application.common.model.InboundAuthenticationRequestConfig;
40+
import org.wso2.carbon.identity.application.common.model.LocalAndOutboundAuthenticationConfig;
4041
import org.wso2.carbon.identity.application.common.model.Property;
4142
import org.wso2.carbon.identity.application.common.model.ServiceProvider;
4243
import org.wso2.carbon.identity.application.common.model.ServiceProviderProperty;
@@ -54,11 +55,6 @@
5455
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
5556
import org.wso2.carbon.utils.multitenancy.MultitenantUtils;
5657

57-
import java.util.ArrayList;
58-
import java.util.List;
59-
import java.util.HashMap;
60-
import java.util.Iterator;
61-
import java.util.Map;
6258
import javax.ws.rs.Consumes;
6359
import javax.ws.rs.DELETE;
6460
import javax.ws.rs.POST;
@@ -68,6 +64,11 @@
6864
import javax.ws.rs.core.Context;
6965
import javax.ws.rs.core.MediaType;
7066
import javax.ws.rs.core.Response;
67+
import java.util.ArrayList;
68+
import java.util.HashMap;
69+
import java.util.Iterator;
70+
import java.util.List;
71+
import java.util.Map;
7172

7273
import static org.wso2.carbon.apimgt.api.model.ApplicationConstants.OAUTH_CLIENT_GRANT;
7374
import static org.wso2.carbon.apimgt.api.model.ApplicationConstants.OAUTH_CLIENT_NAME;
@@ -275,10 +276,10 @@ private OAuthApplicationInfo getExistingApp(String applicationName, boolean saas
275276
*
276277
* @param appRequest OAuthAppRequest object with client's payload content
277278
* @return created Application
278-
* @throws APIKeyMgtException if failed to create the a new application
279+
* @throws APIManagementException if failed to create the new application
279280
*/
280281
private OAuthApplicationInfo createApplication(String applicationName, OAuthAppRequest appRequest,
281-
String grantType) throws APIManagementException {
282+
String grantType) throws APIManagementException {
282283
String userName;
283284
OAuthApplicationInfo applicationInfo = appRequest.getOAuthApplicationInfo();
284285
String appName = applicationInfo.getClientName();
@@ -325,6 +326,14 @@ private OAuthApplicationInfo createApplication(String applicationName, OAuthAppR
325326
logoutConsentProperty.setValue(APIConstants.APP_SKIP_LOGOUT_CONSENT_VALUE);
326327
serviceProviderProperties.add(logoutConsentProperty);
327328

329+
if (APIConstants.JWT.equals(applicationInfo.getTokenType())) {
330+
LocalAndOutboundAuthenticationConfig localAndOutboundConfig =
331+
new LocalAndOutboundAuthenticationConfig();
332+
localAndOutboundConfig.setSkipConsent(true);
333+
localAndOutboundConfig.setSkipLogoutConsent(true);
334+
localAndOutboundConfig.setUseTenantDomainInLocalSubjectIdentifier(true);
335+
serviceProvider.setLocalAndOutBoundAuthenticationConfig(localAndOutboundConfig);
336+
}
328337
String orgId = null;
329338
try {
330339
orgId = RestApiUtil.getValidatedOrganization(securityContext);

0 commit comments

Comments
 (0)