Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spring Cleanup] Remove Spring dependencies in authenticator management API #688

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ Copyright (c) 2021-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 @@ -47,11 +47,6 @@
<artifactId>org.wso2.carbon.identity.application.mgt</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -1,80 +1,65 @@
/*
* Copyright (c) 2021, 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) 2021-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.authenticators.common;

import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.identity.application.mgt.ApplicationManagementService;
import org.wso2.carbon.idp.mgt.IdentityProviderManager;
import org.wso2.carbon.idp.mgt.IdpManager;

/**
* Service holder class for server configuration related services.
*/
public class AuthenticatorsServiceHolder {

private static AuthenticatorsServiceHolder instance = new AuthenticatorsServiceHolder();

private ApplicationManagementService applicationManagementService;
private IdentityProviderManager identityProviderManager;

private AuthenticatorsServiceHolder() {

}

public static AuthenticatorsServiceHolder getInstance() {
private static class ApplicationManagementServiceHolder {
static final ApplicationManagementService SERVICE = (ApplicationManagementService) PrivilegedCarbonContext
.getThreadLocalCarbonContext()
.getOSGiService(ApplicationManagementService.class, null);
}

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

/**
* Get ApplicationManagementService osgi service.
*
* @return ApplicationManagementService
*/
public ApplicationManagementService getApplicationManagementService() {

return AuthenticatorsServiceHolder.getInstance().applicationManagementService;
}

/**
* Set ApplicationManagementService osgi service.
*
* @param applicationManagementService ApplicationManagementService.
*/
public void setApplicationManagementService(ApplicationManagementService applicationManagementService) {

AuthenticatorsServiceHolder.getInstance().applicationManagementService = applicationManagementService;
}

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

return AuthenticatorsServiceHolder.getInstance().identityProviderManager;
return ApplicationManagementServiceHolder.SERVICE;
}

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

AuthenticatorsServiceHolder.getInstance().identityProviderManager = identityProviderManager;
return IdentityProviderManagerHolder.SERVICE;
}
}

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) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ Copyright (c) 2021-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 @@ -105,11 +105,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 Expand Up @@ -169,6 +164,12 @@
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.authenticators.common</artifactId>
lashinijay marked this conversation as resolved.
Show resolved Hide resolved
<version>${project.version}</version>
lashinijay marked this conversation as resolved.
Show resolved Hide resolved
<scope>provided</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
/*
* Copyright (c) 2021, WSO2 LLC. (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) 2021-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.authenticators.v1;

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.authenticators.v1.factories.AuthenticatorsApiServiceFactory;
import org.wso2.carbon.identity.api.server.authenticators.v1.model.Authenticator;
import org.wso2.carbon.identity.api.server.authenticators.v1.model.ConnectedApps;
import org.wso2.carbon.identity.api.server.authenticators.v1.model.Error;
Expand All @@ -39,8 +41,12 @@

public class AuthenticatorsApi {

@Autowired
private AuthenticatorsApiService delegate;
private final AuthenticatorsApiService delegate;

public AuthenticatorsApi() {

this.delegate = AuthenticatorsApiServiceFactory.getAuthenticatorsApi();
}

@Valid
@GET
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,40 @@
/*
* Copyright (c) 2021, 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) 2021-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.authenticators.v1.factories;

import org.wso2.carbon.identity.api.server.authenticators.v1.AuthenticatorsApiService;
import org.wso2.carbon.identity.api.server.authenticators.v1.impl.AuthenticatorsApiServiceImpl;

/**
* This class is the factory class for AuthenticatorsApiService.
*/
public class AuthenticatorsApiServiceFactory {

private final static AuthenticatorsApiService service = new AuthenticatorsApiServiceImpl();
private final static AuthenticatorsApiService SERVICE = new AuthenticatorsApiServiceImpl();

/**
* Get AuthenticatorsApiService.
*
* @return AuthenticatorsApiService
*/
public static AuthenticatorsApiService getAuthenticatorsApi()
{
return service;
return SERVICE;
}
}
Loading