From bf074061f17c03d65ed322dc814bd67a9a0fc043 Mon Sep 17 00:00:00 2001 From: Amalka Subasinghe Date: Mon, 10 May 2021 12:36:01 +0530 Subject: [PATCH] cleaned up components/identity-extensions --- .../org.wso2.carbon.device.mgt.oauth.extensions/pom.xml | 9 ++------- .../handlers/grant/AccessTokenGrantHandler.java | 5 +++-- .../handlers/grant/ExtendedJWTGrantHandler.java | 8 ++++++-- .../handlers/grant/ExtendedSAML2BearerGrantHandler.java | 5 +++-- .../pom.xml | 4 ++-- components/identity-extensions/pom.xml | 2 -- 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml index 27de8ac3a62..ae46c74805c 100644 --- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml @@ -87,11 +87,10 @@ org.wso2.carbon.device.mgt.oauth.extensions.* - + org.wso2.carbon.identity.oauth2.grant.jwt;version="${carbon.identity.jwt.grant.version.range}", org.apache.commons.lang, org.apache.commons.logging, - org.osgi.framework.*;version="${imp.package.version.osgi.framework}", - org.osgi.service.*;version="${imp.package.version.osgi.service}", + org.osgi.service.component, org.wso2.carbon.identity.application.common.model;version="${carbon.identity.framework.version.range}", org.wso2.carbon.identity.application.common;version="${carbon.identity.framework.version.range}", org.wso2.carbon.identity.application.mgt.*;version="${carbon.identity.framework.version.range}", @@ -114,10 +113,6 @@ org.apache.oltu.oauth2.common.validators, org.apache.commons.lang3.tuple, - - - - diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/AccessTokenGrantHandler.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/AccessTokenGrantHandler.java index 4cc78813440..1153cb0561f 100644 --- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/AccessTokenGrantHandler.java +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/AccessTokenGrantHandler.java @@ -21,6 +21,7 @@ package org.wso2.carbon.device.mgt.oauth.extensions.handlers.grant; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.apimgt.keymgt.ScopesIssuer; import org.wso2.carbon.device.mgt.oauth.extensions.handlers.grant.oauth.validator.LocalOAuthValidator; import org.wso2.carbon.device.mgt.oauth.extensions.handlers.grant.oauth.validator.OAuthValidationResponse; import org.wso2.carbon.identity.application.authentication.framework.model.AuthenticatedUser; @@ -57,8 +58,8 @@ public class AccessTokenGrantHandler extends AbstractAuthorizationGrantHandler { } @Override - public boolean validateScope(OAuthTokenReqMessageContext tokReqMsgCtx) throws IdentityOAuth2Exception { - return super.validateScope(tokReqMsgCtx); + public boolean validateScope(OAuthTokenReqMessageContext tokReqMsgCtx) { + return ScopesIssuer.getInstance().setScopes(tokReqMsgCtx); } @Override diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/ExtendedJWTGrantHandler.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/ExtendedJWTGrantHandler.java index f6560e76eb5..006317f1794 100644 --- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/ExtendedJWTGrantHandler.java +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/ExtendedJWTGrantHandler.java @@ -20,10 +20,14 @@ package org.wso2.carbon.device.mgt.oauth.extensions.handlers.grant; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.apimgt.keymgt.ScopesIssuer; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.identity.application.authentication.framework.model.AuthenticatedUser; import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception; import org.wso2.carbon.identity.oauth2.grant.jwt.JWTBearerGrantHandler; import org.wso2.carbon.identity.oauth2.model.RequestParameter; import org.wso2.carbon.identity.oauth2.token.OAuthTokenReqMessageContext; +import org.wso2.carbon.utils.multitenancy.MultitenantUtils; /** * This sets up user with tenant aware username. @@ -34,8 +38,8 @@ public class ExtendedJWTGrantHandler extends JWTBearerGrantHandler { private static final String TENANT_DOMAIN_KEY = "tenantDomain"; @Override - public boolean validateScope(OAuthTokenReqMessageContext tokReqMsgCtx) throws IdentityOAuth2Exception { - return super.validateScope(tokReqMsgCtx); + public boolean validateScope(OAuthTokenReqMessageContext tokReqMsgCtx) { + return ScopesIssuer.getInstance().setScopes(tokReqMsgCtx); } @Override diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/ExtendedSAML2BearerGrantHandler.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/ExtendedSAML2BearerGrantHandler.java index 2193d2d3edd..5caededdafd 100644 --- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/ExtendedSAML2BearerGrantHandler.java +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/ExtendedSAML2BearerGrantHandler.java @@ -20,6 +20,7 @@ package org.wso2.carbon.device.mgt.oauth.extensions.handlers.grant; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.apimgt.keymgt.ScopesIssuer; import org.wso2.carbon.identity.application.authentication.framework.model.AuthenticatedUser; import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception; import org.wso2.carbon.identity.oauth2.token.OAuthTokenReqMessageContext; @@ -34,8 +35,8 @@ public class ExtendedSAML2BearerGrantHandler extends SAML2BearerGrantHandler { private static Log log = LogFactory.getLog(ExtendedSAML2BearerGrantHandler.class); @Override - public boolean validateScope(OAuthTokenReqMessageContext tokReqMsgCtx) throws IdentityOAuth2Exception { - return super.validateScope(tokReqMsgCtx); + public boolean validateScope(OAuthTokenReqMessageContext tokReqMsgCtx) { + return ScopesIssuer.getInstance().setScopes(tokReqMsgCtx); } @Override diff --git a/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml b/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml index abcf3859a37..4adb6539aba 100644 --- a/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml @@ -109,8 +109,8 @@ org.apache.commons.httpclient, org.apache.commons.logging, org.apache.commons.codec.binary;version="${commons-codec.wso2.osgi.version.range}", - org.osgi.framework.*;version="${imp.package.version.osgi.framework}", - org.osgi.service.*;version="${imp.package.version.osgi.service}", + org.osgi.framework, + org.osgi.service.component, org.wso2.carbon.core.security, org.wso2.carbon.core.services.authentication, org.wso2.carbon.utils.multitenancy, diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml index de175d9dbac..bbf1f08a4e0 100644 --- a/components/identity-extensions/pom.xml +++ b/components/identity-extensions/pom.xml @@ -33,8 +33,6 @@ http://wso2.org - - org.wso2.carbon.identity.jwt.client.extension