Skip to content

Commit

Permalink
Merge pull request #699 from NipuniBhagya/feature-remove-spring-idp
Browse files Browse the repository at this point in the history
[Spring Cleanup] Remove Spring dependencies in the IDP management API
  • Loading branch information
lashinijay authored Dec 9, 2024
2 parents 9818baa + ca61341 commit cd4e9b9
Show file tree
Hide file tree
Showing 15 changed files with 308 additions and 434 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ Copyright (c) 2019-2024, WSO2 LLC. (http://www.wso2.com).
~
~ WSO2 Inc. licenses this file to you under the Apache 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
Expand Down 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,40 @@
*/
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.getInstance();
}

/**
* 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 +71,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
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ Copyright (c) 2019-2024, WSO2 LLC. (http://www.wso2.com).
~
~ WSO2 Inc. licenses this file to you under the Apache 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
Expand Down 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,12 @@

public class IdentityProvidersApi {

@Autowired
private IdentityProvidersApiService delegate;
private final IdentityProvidersApiService delegate;

public IdentityProvidersApi() {

this.delegate = IdentityProvidersApiServiceFactory.getIdentityProvidersApi();
}

@Valid
@POST
Expand Down
Loading

0 comments on commit cd4e9b9

Please sign in to comment.