-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Spring Cleanup] Remove Spring dependencies in authenticator managem…
…ent API (#688) * Remove Spring dependencies in authenticator management API * Resolve PR comments * Refactor ServerAuthenticatorManagementServiceFactory class
- Loading branch information
1 parent
1954f9a
commit eff8fce
Showing
11 changed files
with
222 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 32 additions & 47 deletions
79
...rg/wso2/carbon/identity/api/server/authenticators/common/AuthenticatorsServiceHolder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
51 changes: 0 additions & 51 deletions
51
...n/identity/api/server/authenticators/common/factory/ApplicationMgtOSGIServiceFactory.java
This file was deleted.
Oops, something went wrong.
51 changes: 0 additions & 51 deletions
51
...o2/carbon/identity/api/server/authenticators/common/factory/IdPMgtOSGIServiceFactory.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 26 additions & 16 deletions
42
...rbon/identity/api/server/authenticators/v1/factories/AuthenticatorsApiServiceFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
Oops, something went wrong.