mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge branch 'master' of https://github.com/Kamidu/carbon-device-mgt into Kamidu-master
This commit is contained in:
commit
182e15d632
@ -87,34 +87,16 @@
|
||||
<instructions>
|
||||
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
|
||||
<Bundle-Name>${pom.artifactId}</Bundle-Name>
|
||||
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
|
||||
<Bundle-Description>Identity backend Bundle</Bundle-Description>
|
||||
<Bundle-Activator>org.wso2.carbon.identity.authenticator.backend.oauth.internal.OauthAuthenticatorServiceComponent</Bundle-Activator>
|
||||
<Private-Package>
|
||||
org.wso2.sample.authenticator.internal
|
||||
org.wso2.org.wso2.carbon.identity.authenticator.backend.oauth.internal
|
||||
</Private-Package>
|
||||
<Export-Package>
|
||||
!org.wso2.sample.authenticator.internal,
|
||||
org.wso2.sample.authenticator.*,
|
||||
org.wso2.carbon.identity.authenticator.backend.oauth.*
|
||||
</Export-Package>
|
||||
<Import-Package>
|
||||
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
|
||||
</Import-Package>
|
||||
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
@ -20,24 +20,26 @@ 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(),
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -45,6 +45,10 @@
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.oauth.extensions</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.identity.authenticator.backend.oauth</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@ -73,6 +77,9 @@
|
||||
<bundleDef>
|
||||
org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.oauth.extensions:${carbon.device.mgt.version}
|
||||
</bundleDef>
|
||||
<bundleDef>
|
||||
org.wso2.carbon.devicemgt:org.wso2.carbon.identity.authenticator.backend.oauth:${carbon.device.mgt.version}
|
||||
</bundleDef>
|
||||
</bundles>
|
||||
<importFeatures>
|
||||
<importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version}
|
||||
|
||||
5
pom.xml
5
pom.xml
@ -247,6 +247,11 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.identity.authenticator.backend.oauth</artifactId>
|
||||
<version>${carbon.device.mgt.version}</version>
|
||||
</dependency>
|
||||
<!-- Device Management dependencies -->
|
||||
|
||||
<!-- Governance dependencies -->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user