Skip to content

Commit

Permalink
Remove Spring dependencies in the IDP management API
Browse files Browse the repository at this point in the history
  • Loading branch information
NipuniBhagya committed Oct 10, 2024
1 parent a76694f commit b5321cf
Show file tree
Hide file tree
Showing 15 changed files with 278 additions and 430 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@
<artifactId>org.wso2.carbon.identity.claim.metadata.mgt</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>org.wso2.carbon.identity.template.mgt</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
/*
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*                                                                         
* Licensed 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.
* Copyright (c) 2019-2024, 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.api.server.idp.common;

import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.identity.claim.metadata.mgt.ClaimMetadataManagementService;
import org.wso2.carbon.identity.template.mgt.TemplateManager;
import org.wso2.carbon.idp.mgt.IdentityProviderManager;
Expand All @@ -25,59 +28,41 @@
*/
public class IdentityProviderServiceHolder {

private static IdentityProviderManager identityProviderManager;
private static ClaimMetadataManagementService claimMetadataManagementService;
private static TemplateManager templateManager;
private IdentityProviderServiceHolder() {}

/**
* Get IdentityProviderManager osgi service.
*
* @return IdentityProviderManager
*/
public static IdentityProviderManager getIdentityProviderManager() {

return identityProviderManager;
private static class IdentityProviderManagerHolder {
static final IdentityProviderManager SERVICE = (IdentityProviderManager) PrivilegedCarbonContext
.getThreadLocalCarbonContext().getOSGiService(IdentityProviderManager.class, null);
}

/**
* Set IdentityProviderManager osgi service.
*
* @param identityProviderManager IdentityProviderManager.
*/
public static void setIdentityProviderManager(IdentityProviderManager identityProviderManager) {

IdentityProviderServiceHolder.identityProviderManager = identityProviderManager;
private static class ClaimMetadataManagementServiceHolder {
static final ClaimMetadataManagementService SERVICE = (ClaimMetadataManagementService) PrivilegedCarbonContext
.getThreadLocalCarbonContext().getOSGiService(ClaimMetadataManagementService.class, null);
}

/**
* Get ClaimMetadataManagementService osgi service.
*
* @return ClaimMetadataManagementService.
*/
public static ClaimMetadataManagementService getClaimMetadataManagementService() {

return claimMetadataManagementService;
private static class TemplateManagerHolder {
static final TemplateManager SERVICE = (TemplateManager) PrivilegedCarbonContext
.getThreadLocalCarbonContext().getOSGiService(TemplateManager.class, null);
}

/**
* Set ClaimMetadataManagementService osgi service.
* Get IdentityProviderManager osgi service.
*
* @param claimMetadataManagementService ClaimMetadataManagementService.
* @return IdentityProviderManager
*/
public static void setClaimMetadataManagementService(
ClaimMetadataManagementService claimMetadataManagementService) {
public static IdentityProviderManager getIdentityProviderManager() {

IdentityProviderServiceHolder.claimMetadataManagementService = claimMetadataManagementService;
return IdentityProviderManagerHolder.SERVICE;
}

/**
* Set TemplateManager osgi service.
* Get ClaimMetadataManagementService osgi service.
*
* @param templateManager TemplateManager service
* @return ClaimMetadataManagementService.
*/
public static void setTemplateManager(TemplateManager templateManager) {
public static ClaimMetadataManagementService getClaimMetadataManagementService() {

IdentityProviderServiceHolder.templateManager = templateManager;
return ClaimMetadataManagementServiceHolder.SERVICE;
}

/**
Expand All @@ -87,6 +72,6 @@ public static void setTemplateManager(TemplateManager templateManager) {
*/
public static TemplateManager getTemplateManager() {

return templateManager;
return TemplateManagerHolder.SERVICE;
}
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@
<artifactId>cxf-rt-rs-service-description</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
* Copyright (c) 2023-2024, 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
Expand All @@ -19,12 +19,12 @@
package org.wso2.carbon.identity.api.server.idp.v1;

import org.apache.cxf.jaxrs.ext.search.SearchContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
import java.io.InputStream;
import java.util.List;

import org.wso2.carbon.identity.api.server.idp.v1.factories.IdentityProvidersApiServiceFactory;
import org.wso2.carbon.identity.api.server.idp.v1.model.AssociationRequest;
import org.wso2.carbon.identity.api.server.idp.v1.model.AssociationResponse;
import org.wso2.carbon.identity.api.server.idp.v1.model.Claims;
Expand Down Expand Up @@ -53,7 +53,6 @@
import org.wso2.carbon.identity.api.server.idp.v1.model.Patch;
import org.wso2.carbon.identity.api.server.idp.v1.model.ProvisioningResponse;
import org.wso2.carbon.identity.api.server.idp.v1.model.Roles;
import org.wso2.carbon.identity.api.server.idp.v1.IdentityProvidersApiService;

import javax.validation.Valid;
import javax.ws.rs.*;
Expand All @@ -68,8 +67,11 @@

public class IdentityProvidersApi {

@Autowired
private IdentityProvidersApiService delegate;
private final IdentityProvidersApiService delegate;

public IdentityProvidersApi() {
this.delegate = IdentityProvidersApiServiceFactory.getIdentityProvidersApi();
}

@Valid
@POST
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
* Copyright (c) 2023-2024, 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
Expand All @@ -18,17 +18,15 @@

package org.wso2.carbon.identity.api.server.idp.v1;

import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

import org.wso2.carbon.identity.api.server.idp.v1.factories.TrustedTokenIssuersApiServiceFactory;
import org.wso2.carbon.identity.api.server.idp.v1.model.Error;
import org.wso2.carbon.identity.api.server.idp.v1.model.IdentityProviderListResponse;
import java.util.List;
import org.wso2.carbon.identity.api.server.idp.v1.model.Patch;
import org.wso2.carbon.identity.api.server.idp.v1.model.TrustedTokenIssuerPOSTRequest;
import org.wso2.carbon.identity.api.server.idp.v1.model.TrustedTokenIssuerResponse;
import org.wso2.carbon.identity.api.server.idp.v1.TrustedTokenIssuersApiService;

import javax.validation.Valid;
import javax.ws.rs.*;
Expand All @@ -41,8 +39,11 @@

public class TrustedTokenIssuersApi {

@Autowired
private TrustedTokenIssuersApiService delegate;
private final TrustedTokenIssuersApiService delegate;

public TrustedTokenIssuersApi() {
this.delegate = TrustedTokenIssuersApiServiceFactory.getTrustedTokenIssuersApi();
}

@Valid
@POST
Expand Down
Loading

0 comments on commit b5321cf

Please sign in to comment.