From 41353f8014138a6ceb639fbb25496cd166cb8cd6 Mon Sep 17 00:00:00 2001 From: Milan Perera Date: Tue, 31 Jan 2017 16:37:33 +0530 Subject: [PATCH] Fixed issues in scope validation feature --- .../pom.xml | 22 +++---------------- .../handlers/ScopeValidationHandler.java | 2 +- .../ExtendedSAML2BearerGrantHandler.java | 4 ++-- pom.xml | 3 ++- 4 files changed, 8 insertions(+), 23 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 49ebf9d72e..21fc8bc134 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,27 +87,16 @@ org.apache.commons.logging, org.osgi.service.component, org.wso2.carbon.device.mgt.oauth.extensions.*, - org.wso2.carbon.identity.application.common.model, - org.wso2.carbon.identity.oauth.callback, - org.wso2.carbon.identity.oauth2, - org.wso2.carbon.identity.oauth2.model, - org.wso2.carbon.identity.oauth2.validators, + org.wso2.carbon.identity.*;version="${carbon.identity.framework.version.range}", org.wso2.carbon.user.api, org.wso2.carbon.user.core.service, org.wso2.carbon.user.core.tenant, org.json.simple, javax.cache, - org.wso2.carbon.identity.core.util, - org.wso2.carbon.identity.oauth2.dto, - org.wso2.carbon.identity.oauth2.token, org.wso2.carbon.utils, org.wso2.carbon.context, - org.wso2.carbon.identity.oauth.cache, - org.wso2.carbon.identity.oauth.config, - org.wso2.carbon.identity.oauth2.dao, org.wso2.carbon.utils.multitenancy, org.apache.commons.codec.binary;version="${commons-codec.wso2.osgi.version.range}", - org.wso2.carbon.identity.application.authentication.framework.model, org.wso2.carbon.base, org.apache.commons.collections, org.apache.commons.lang, @@ -116,15 +105,10 @@ org.opensaml.security, org.opensaml.xml.*, org.w3c.dom, - org.wso2.carbon.identity.application.common.util, - org.wso2.carbon.identity.base, - org.wso2.carbon.identity.oauth2.token.handlers.grant.*, - org.wso2.carbon.identity.oauth2.util, - org.wso2.carbon.idp.mgt, + org.wso2.carbon.idp.mgt;version="${carbon.identity.framework.version.range}", org.opensaml.common.xml, - org.wso2.carbon.identity.oauth.common, org.opensaml, - org.wso2.carbon.apimgt.keymgt.issuers + org.wso2.carbon.apimgt.keymgt;version="${carbon.api.mgt.version.range}" diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/ScopeValidationHandler.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/ScopeValidationHandler.java index 0c3964e9c0..e182c0b3a0 100644 --- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/ScopeValidationHandler.java +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/ScopeValidationHandler.java @@ -88,7 +88,7 @@ public class ScopeValidationHandler extends OAuth2ScopeValidator { } // validate scope via relevant scope validator that matches with the prefix - return scopeValidator.validateScope(accessTokenDO, resourceScope); + return scopeValidator.validateScope(accessTokenDO, resource); } private String getResourceScope(String resource) { 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 0ba3d273fb..94af1a4661 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 @@ -38,7 +38,7 @@ import org.opensaml.xml.security.x509.X509Credential; import org.opensaml.xml.signature.SignatureValidator; import org.opensaml.xml.validation.ValidationException; import org.w3c.dom.NodeList; -import org.wso2.carbon.apimgt.keymgt.issuers.ScopesIssuingHandler; +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.application.common.model.FederatedAuthenticatorConfig; @@ -101,7 +101,7 @@ public class ExtendedSAML2BearerGrantHandler extends AbstractAuthorizationGrantH @Override public boolean validateScope(OAuthTokenReqMessageContext tokReqMsgCtx) { - return ScopesIssuingHandler.getInstance().setScopes(tokReqMsgCtx); + return ScopesIssuer.getInstance().setScopes(tokReqMsgCtx); } /** diff --git a/pom.xml b/pom.xml index 6abdc06097..4e0e915afe 100644 --- a/pom.xml +++ b/pom.xml @@ -1766,6 +1766,7 @@ 5.7.0 + [5.0.0, 6.0.0) 5.3.1 5.3.0 @@ -1797,7 +1798,7 @@ [2.6.0,3.0.0) - 6.1.35 + 6.1.64 (6.0.0,7.0.0]