-
Notifications
You must be signed in to change notification settings - Fork 544
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add service layer support for the custom local auth extensions.
- Loading branch information
1 parent
4a85b28
commit baefb68
Showing
16 changed files
with
483 additions
and
110 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
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
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
45 changes: 45 additions & 0 deletions
45
.../carbon/identity/application/common/exception/AuthenticatorMgtServerRuntimeException.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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright (c) 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.application.common.exception; | ||
|
||
/** | ||
* Authenticator configuration management server runtime exception. | ||
*/ | ||
public class AuthenticatorMgtServerRuntimeException extends RuntimeException { | ||
|
||
private final String errorCode; | ||
private final String description; | ||
|
||
public AuthenticatorMgtServerRuntimeException(String message, String description, String errorCode) { | ||
|
||
super(message); | ||
this.errorCode = errorCode; | ||
this.description = description; | ||
} | ||
|
||
public String getErrorCode() { | ||
|
||
return this.errorCode; | ||
} | ||
|
||
public String getDescription() { | ||
|
||
return this.description; | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
...g/wso2/carbon/identity/application/common/internal/ApplicationCommonServiceComponent.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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package org.wso2.carbon.identity.application.common.internal; | ||
|
||
import org.apache.commons.logging.Log; | ||
import org.apache.commons.logging.LogFactory; | ||
import org.osgi.framework.BundleContext; | ||
import org.osgi.service.component.ComponentContext; | ||
import org.osgi.service.component.annotations.Activate; | ||
import org.osgi.service.component.annotations.Component; | ||
import org.osgi.service.component.annotations.Reference; | ||
import org.osgi.service.component.annotations.ReferenceCardinality; | ||
import org.osgi.service.component.annotations.ReferencePolicy; | ||
import org.wso2.carbon.identity.action.management.ActionManagementService; | ||
import org.wso2.carbon.identity.application.common.ApplicationAuthenticatorService; | ||
|
||
/** | ||
* OSGI service component for the Application Common Service Component. | ||
*/ | ||
@Component( | ||
name = "application.common.service.component", | ||
immediate = true | ||
) | ||
public class ApplicationCommonServiceComponent { | ||
|
||
private static final Log LOG = LogFactory.getLog(ApplicationCommonServiceComponent.class); | ||
|
||
@Activate | ||
protected void activate(ComponentContext context) { | ||
|
||
try { | ||
BundleContext bundleCtx = context.getBundleContext(); | ||
bundleCtx.registerService(ApplicationAuthenticatorService.class.getName(), | ||
ApplicationAuthenticatorService.getInstance(), | ||
null); | ||
LOG.debug("Application Authenticator Service is activated."); | ||
} catch (Throwable e) { | ||
LOG.error("Error while initializing Application Authenticator Service component.", e); | ||
} | ||
} | ||
|
||
@Reference( | ||
name = "action.management.service", | ||
service = ActionManagementService.class, | ||
cardinality = ReferenceCardinality.MANDATORY, | ||
policy = ReferencePolicy.DYNAMIC, | ||
unbind = "unsetActionManagementService" | ||
) | ||
protected void setActionManagementService(ActionManagementService actionManagementService) { | ||
|
||
if (LOG.isDebugEnabled()) { | ||
LOG.debug( | ||
"Registering a reference for ActionManagementService in the ApplicationCommonServiceComponent."); | ||
} | ||
ApplicationCommonServiceDataHolder.getInstance().setActionManagementService(actionManagementService); | ||
} | ||
|
||
protected void unsetActionManagementService(ActionManagementService actionManagementService) { | ||
|
||
if (LOG.isDebugEnabled()) { | ||
LOG.debug("Unregistering the reference for ActionManagementService in the " + | ||
"ApplicationCommonServiceComponent."); | ||
} | ||
if (ApplicationCommonServiceDataHolder.getInstance().getActionManagementService() | ||
.equals(actionManagementService)) { | ||
ApplicationCommonServiceDataHolder.getInstance().setActionManagementService(null); | ||
} | ||
} | ||
} |
Oops, something went wrong.