Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7E8AD18288 for ; Fri, 22 Jan 2016 12:51:31 +0000 (UTC) Received: (qmail 1064 invoked by uid 500); 22 Jan 2016 12:51:31 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 1000 invoked by uid 500); 22 Jan 2016 12:51:31 -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 991 invoked by uid 99); 22 Jan 2016 12:51:31 -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, 22 Jan 2016 12:51:31 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 06F38E03CD; Fri, 22 Jan 2016 12:51:30 +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 Message-Id: <9f86da6b019140288a94025bfb3b4564@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: cxf git commit: Minor updates to the token introspection code Date: Fri, 22 Jan 2016 12:51:30 +0000 (UTC) Repository: cxf Updated Branches: refs/heads/master bc5776b27 -> 2b58d4804 Minor updates to the token introspection code Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/2b58d480 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/2b58d480 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/2b58d480 Branch: refs/heads/master Commit: 2b58d48041837dfa7f954c58b003a6000895f7d0 Parents: bc5776b Author: Sergey Beryozkin Authored: Fri Jan 22 12:51:14 2016 +0000 Committer: Sergey Beryozkin Committed: Fri Jan 22 12:51:14 2016 +0000 ---------------------------------------------------------------------- .../cxf/rs/security/oauth2/provider/OAuthJSONProvider.java | 2 +- .../security/oauth2/services/TokenIntrospectionService.java | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/2b58d480/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/OAuthJSONProvider.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/OAuthJSONProvider.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/OAuthJSONProvider.java index 42f039a..1a3283b 100644 --- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/OAuthJSONProvider.java +++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/OAuthJSONProvider.java @@ -97,7 +97,7 @@ public class OAuthJSONProvider implements MessageBodyWriter, if (!StringUtils.isEmpty(obj.getAud())) { sb.append(","); if (obj.getAud().size() == 1) { - appendJsonPair(sb, "aud", obj.getAud()); + appendJsonPair(sb, "aud", obj.getAud().get(0)); } else { sb.append("["); StringBuilder arr = new StringBuilder(); http://git-wip-us.apache.org/repos/asf/cxf/blob/2b58d480/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/TokenIntrospectionService.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/TokenIntrospectionService.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/TokenIntrospectionService.java index 645e3a4..9dc4bf8 100644 --- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/TokenIntrospectionService.java +++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/TokenIntrospectionService.java @@ -36,6 +36,7 @@ import org.apache.cxf.jaxrs.ext.MessageContext; import org.apache.cxf.jaxrs.utils.ExceptionUtils; import org.apache.cxf.rs.security.oauth2.common.ServerAccessToken; import org.apache.cxf.rs.security.oauth2.common.TokenIntrospection; +import org.apache.cxf.rs.security.oauth2.common.UserSubject; import org.apache.cxf.rs.security.oauth2.provider.OAuthDataProvider; import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants; import org.apache.cxf.rs.security.oauth2.utils.OAuthUtils; @@ -62,8 +63,12 @@ public class TokenIntrospectionService { if (!at.getScopes().isEmpty()) { response.setScope(OAuthUtils.convertPermissionsToScope(at.getScopes())); } - if (at.getSubject() != null) { + UserSubject userSubject = at.getSubject(); + if (userSubject != null) { response.setUsername(at.getSubject().getLogin()); + if (userSubject.getId() != null) { + response.setSub(userSubject.getId()); + } } if (!StringUtils.isEmpty(at.getAudiences())) { response.setAud(at.getAudiences());