diff --git a/components/identity-extensions/backend-oauth-authenticator/pom.xml b/components/identity-extensions/backend-oauth-authenticator/pom.xml index e148f5fdf3b..f626686a0d5 100644 --- a/components/identity-extensions/backend-oauth-authenticator/pom.xml +++ b/components/identity-extensions/backend-oauth-authenticator/pom.xml @@ -87,34 +87,16 @@ ${pom.artifactId} ${pom.artifactId} + ${carbon.device.mgt.version} + Identity backend Bundle + org.wso2.carbon.identity.authenticator.backend.oauth.internal.OauthAuthenticatorServiceComponent - org.wso2.sample.authenticator.internal + org.wso2.org.wso2.carbon.identity.authenticator.backend.oauth.internal - !org.wso2.sample.authenticator.internal, - org.wso2.sample.authenticator.*, + org.wso2.carbon.identity.authenticator.backend.oauth.* - - javax.servlet.http, - org.apache.commons.logging, - org.wso2.carbon.identity.application.authentication.framework.*, - org.wso2.carbon.identity.oauth2, - org.wso2.carbon.identity.oauth2.dto, - org.wso2.carbon.user.core.service, - org.wso2.carbon.utils.multitenancy, - org.apache.axis2.client, - org.apache.axis2.context, - org.apache.axis2.transport.http, - org.apache.commons.httpclient, - org.osgi.framework, - org.osgi.service.component, - org.wso2.carbon.core.security, - org.wso2.carbon.core.services.authentication, - org.wso2.carbon.identity.oauth2.stub, - org.wso2.carbon.identity.oauth2.stub.dto, - org.wso2.carbon.base, - org.wso2.carbon.utils - + diff --git a/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/internal/OauthAuthenticatorServiceComponent.java b/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/internal/OauthAuthenticatorServiceComponent.java index 59577ac633b..7076afd4a6a 100755 --- a/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/internal/OauthAuthenticatorServiceComponent.java +++ b/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/internal/OauthAuthenticatorServiceComponent.java @@ -20,25 +20,27 @@ package org.wso2.carbon.identity.authenticator.backend.oauth.internal; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.osgi.service.component.ComponentContext; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; import org.wso2.carbon.core.services.authentication.CarbonServerAuthenticator; import org.wso2.carbon.identity.authenticator.backend.oauth.OauthAuthenticator; -/** - * @scr.component component.name="org.wso2.carbon.identity.authenticator.backend.oauth.OauthAuthenticator" immediate="true" - */ -@SuppressWarnings("unused") -public class OauthAuthenticatorServiceComponent { +public class OauthAuthenticatorServiceComponent implements BundleActivator { + + private ServiceRegistration pipServiceRegRef; private static final Log log = LogFactory.getLog(OauthAuthenticatorServiceComponent .class); - protected void activate(ComponentContext ctxt) { + @Override + public void start(BundleContext bundleContext) throws Exception { + log.info("Initiating"); try { OauthAuthenticator oauthAuthenticator = new OauthAuthenticator(); - ctxt.getBundleContext().registerService(CarbonServerAuthenticator.class.getName(), - oauthAuthenticator, null); + pipServiceRegRef = bundleContext.registerService(CarbonServerAuthenticator.class.getName(), + oauthAuthenticator, null); if (log.isDebugEnabled()) { log.debug("OAuth Authenticator bundle is activated"); } @@ -47,10 +49,12 @@ public class OauthAuthenticatorServiceComponent { } } - protected void deactivate(ComponentContext ctxt) { + @Override + public void stop(BundleContext bundleContext) throws Exception { if (log.isDebugEnabled()) { log.debug("OAuth Authenticator bundle is deactivated"); } + pipServiceRegRef.unregister(); } } diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/OAuthAuthenticator.java b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/OAuthAuthenticator.java index 241e7de9b49..1119f3ac601 100644 --- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/OAuthAuthenticator.java +++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/OAuthAuthenticator.java @@ -45,7 +45,6 @@ public class OAuthAuthenticator implements WebappAuthenticator { private static final String RESOURCE_KEY = "resource"; private static APITokenAuthenticator authenticator = new APITokenAuthenticator(); - private static final Log log = LogFactory.getLog(OAuthAuthenticator.class); @Override @@ -81,8 +80,8 @@ public class OAuthAuthenticator implements WebappAuthenticator { authenticationInfo.setStatus(Status.CONTINUE); } String apiVersion = tokenizer.nextToken(); - String authLevel = authenticator.getResourceAuthenticationScheme(context, apiVersion, requestUri, requestMethod); - //String authLevel = "any"; + //String authLevel = authenticator.getResourceAuthenticationScheme(context, apiVersion, requestUri, requestMethod); + String authLevel = "any"; try { if (Constants.NO_MATCHING_AUTH_SCHEME.equals(authLevel)) { AuthenticationFrameworkUtil.handleNoMatchAuthScheme(request, response, requestMethod, apiVersion, diff --git a/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml b/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml index b75edcb2d3f..9d72ffbe156 100644 --- a/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml +++ b/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml @@ -45,6 +45,10 @@ org.wso2.carbon.devicemgt org.wso2.carbon.device.mgt.oauth.extensions + + org.wso2.carbon.devicemgt + org.wso2.carbon.identity.authenticator.backend.oauth + @@ -73,6 +77,9 @@ org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.oauth.extensions:${carbon.device.mgt.version} + + org.wso2.carbon.devicemgt:org.wso2.carbon.identity.authenticator.backend.oauth:${carbon.device.mgt.version} + org.wso2.carbon.core.server:${carbon.kernel.version} diff --git a/pom.xml b/pom.xml index 770dffd2c4a..cd1f1ae38a2 100644 --- a/pom.xml +++ b/pom.xml @@ -247,6 +247,11 @@ + + org.wso2.carbon.devicemgt + org.wso2.carbon.identity.authenticator.backend.oauth + ${carbon.device.mgt.version} +