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 79E6A182AE for ; Fri, 22 Jan 2016 12:53:58 +0000 (UTC) Received: (qmail 7056 invoked by uid 500); 22 Jan 2016 12:53:58 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 6998 invoked by uid 500); 22 Jan 2016 12:53:58 -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 6989 invoked by uid 99); 22 Jan 2016 12:53:58 -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:53:58 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E026EE0098; Fri, 22 Jan 2016 12:53:57 +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: X-Mailer: ASF-Git Admin Mailer Subject: cxf git commit: Minor updates to the token introspection code Date: Fri, 22 Jan 2016 12:53:57 +0000 (UTC) Repository: cxf Updated Branches: refs/heads/3.1.x-fixes 8130ca0ac -> 5705d3db6 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/5705d3db Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/5705d3db Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/5705d3db Branch: refs/heads/3.1.x-fixes Commit: 5705d3db6407dc2e8231f1e3690c5e81cf57308d Parents: 8130ca0 Author: Sergey Beryozkin Authored: Fri Jan 22 12:51:14 2016 +0000 Committer: Sergey Beryozkin Committed: Fri Jan 22 12:52:30 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/5705d3db/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/5705d3db/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());