Repository: cxf Updated Branches: refs/heads/3.0.x-fixes dbfbbbbf2 -> e525c7701
[CXF-6561, CXF-6562] Checking a null subject in ResourceOwnerGrantHandler, patch from Karl von Randow applied with minor updates, This closes #83 Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e525c770 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e525c770 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e525c770 Branch: refs/heads/3.0.x-fixes Commit: e525c7701c9665d8bd37dbc39694b22f330b9a60 Parents: b097710 Author: Sergey Beryozkin <[email protected]> Authored: Thu Aug 27 17:28:04 2015 +0100 Committer: Sergey Beryozkin <[email protected]> Committed: Thu Aug 27 17:38:38 2015 +0100 ---------------------------------------------------------------------- .../grants/owner/ResourceOwnerGrantHandler.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/e525c770/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/owner/ResourceOwnerGrantHandler.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/owner/ResourceOwnerGrantHandler.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/owner/ResourceOwnerGrantHandler.java index d7f6c33..58718b8 100644 --- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/owner/ResourceOwnerGrantHandler.java +++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/owner/ResourceOwnerGrantHandler.java @@ -47,13 +47,17 @@ public class ResourceOwnerGrantHandler extends AbstractGrantHandler { throw new OAuthServiceException( new OAuthError(OAuthConstants.INVALID_REQUEST)); } - - UserSubject subject = loginHandler.createSubject(ownerName, ownerPassword); - - if (subject == null) { - throw new OAuthServiceException(OAuthConstants.INVALID_GRANT); + UserSubject subject = null; + try { + subject = loginHandler.createSubject(ownerName, ownerPassword); + if (subject == null) { + throw new OAuthServiceException(OAuthConstants.INVALID_GRANT); + } + } catch (OAuthServiceException ex) { + throw ex; + } catch (Exception ex) { + throw new OAuthServiceException(OAuthConstants.INVALID_GRANT, ex); } - return doCreateAccessToken(client, subject, params);
