Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 54104200B8D for ; Fri, 23 Sep 2016 13:52:55 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 52B96160ADA; Fri, 23 Sep 2016 11:52:55 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 9E742160ACA for ; Fri, 23 Sep 2016 13:52:54 +0200 (CEST) Received: (qmail 61512 invoked by uid 500); 23 Sep 2016 11:52:53 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 61496 invoked by uid 99); 23 Sep 2016 11:52:53 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Sep 2016 11:52:53 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7EF12E056F; Fri, 23 Sep 2016 11:52:53 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sergeyb@apache.org To: commits@cxf.apache.org Date: Fri, 23 Sep 2016 11:52:54 -0000 Message-Id: In-Reply-To: <0f52b5895c524fae9663f7fb945185fb@git.apache.org> References: <0f52b5895c524fae9663f7fb945185fb@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/2] cxf git commit: Starting with a dynamic registration service test, more to follow archived-at: Fri, 23 Sep 2016 11:52:55 -0000 Starting with a dynamic registration service test, more to follow Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/f6293b0c Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/f6293b0c Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/f6293b0c Branch: refs/heads/3.1.x-fixes Commit: f6293b0cbfd682a17d0f9549622cace14c68287a Parents: d345b60 Author: Sergey Beryozkin Authored: Fri Sep 23 12:48:59 2016 +0100 Committer: Sergey Beryozkin Committed: Fri Sep 23 12:52:33 2016 +0100 ---------------------------------------------------------------------- .../rs/security/oauth2/services/DynamicRegistrationService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/f6293b0c/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/DynamicRegistrationService.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/DynamicRegistrationService.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/DynamicRegistrationService.java index a0d6bc7..78b971d 100644 --- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/DynamicRegistrationService.java +++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/DynamicRegistrationService.java @@ -80,7 +80,7 @@ public class DynamicRegistrationService extends AbstractOAuthService { String[] authParts = AuthorizationUtils.getAuthorizationParts(getMessageContext(), Collections.singleton(OAuthConstants.BEARER_AUTHORIZATION_SCHEME)); if (authParts.length != 2 || !authParts[1].equals(accessToken)) { - throw ExceptionUtils.toForbiddenException(null, null); + throw ExceptionUtils.toNotAuthorizedException(null, null); } } @@ -141,6 +141,9 @@ public class DynamicRegistrationService extends AbstractOAuthService { protected Client readClient(String clientId) { Client c = clientProvider.getClient(clientId); + if (c == null) { + throw ExceptionUtils.toNotAuthorizedException(null, null); + } String regAccessToken = c.getProperties().get(ClientRegistrationResponse.REG_ACCESS_TOKEN); // Or check OAuthDataProvider.getAccessToken // if OAuthDataProvider.createAccessToken was used