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 B8EBFD5A8 for ; Mon, 3 Dec 2012 18:01:27 +0000 (UTC) Received: (qmail 26231 invoked by uid 500); 3 Dec 2012 18:01:27 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 26182 invoked by uid 500); 3 Dec 2012 18:01:27 -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 26175 invoked by uid 99); 3 Dec 2012 18:01:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Dec 2012 18:01:27 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Dec 2012 18:01:26 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 1CECC23889E0; Mon, 3 Dec 2012 18:01:06 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1416602 - in /cxf/branches/2.6.x-fixes: ./ rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/ Date: Mon, 03 Dec 2012 18:01:04 -0000 To: commits@cxf.apache.org From: sergeyb@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121203180106.1CECC23889E0@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sergeyb Date: Mon Dec 3 18:01:03 2012 New Revision: 1416602 URL: http://svn.apache.org/viewvc?rev=1416602&view=rev Log: Merged revisions 1416601 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1416601 | sergeyb | 2012-12-03 17:57:38 +0000 (Mon, 03 Dec 2012) | 1 line [CXF-4669] Updating ImplicitGrantService to report expires_in, thanks to Steven Tippetts ........ Modified: cxf/branches/2.6.x-fixes/ (props changed) cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractOAuthService.java cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AccessTokenService.java cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/ImplicitGrantService.java Propchange: cxf/branches/2.6.x-fixes/ ------------------------------------------------------------------------------ Merged /cxf/trunk:r1416601 Propchange: cxf/branches/2.6.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractOAuthService.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractOAuthService.java?rev=1416602&r1=1416601&r2=1416602&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractOAuthService.java (original) +++ cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractOAuthService.java Mon Dec 3 18:01:03 2012 @@ -42,6 +42,15 @@ public abstract class AbstractOAuthServi private MessageContext mc; private OAuthDataProvider dataProvider; private boolean blockUnsecureRequests; + private boolean writeOptionalParameters = true; + + public void setWriteOptionalParameters(boolean write) { + writeOptionalParameters = write; + } + + public boolean isWriteOptionalParameters() { + return writeOptionalParameters; + } @Context public void setMessageContext(MessageContext context) { Modified: cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AccessTokenService.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AccessTokenService.java?rev=1416602&r1=1416601&r2=1416602&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AccessTokenService.java (original) +++ cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AccessTokenService.java Mon Dec 3 18:01:03 2012 @@ -52,13 +52,8 @@ import org.apache.cxf.rs.security.oauth2 @Path("/token") public class AccessTokenService extends AbstractOAuthService { private List grantHandlers = Collections.emptyList(); - private boolean writeOptionalParameters = true; private boolean writeCustomErrors; - public void setWriteOptionalParameters(boolean write) { - writeOptionalParameters = write; - } - public void setWriteCustomErrors(boolean write) { writeCustomErrors = write; } @@ -109,7 +104,7 @@ public class AccessTokenService extends ClientAccessToken clientToken = new ClientAccessToken(serverToken.getTokenType(), serverToken.getTokenKey()); clientToken.setRefreshToken(serverToken.getRefreshToken()); - if (writeOptionalParameters) { + if (isWriteOptionalParameters()) { clientToken.setExpiresIn(serverToken.getExpiresIn()); List perms = serverToken.getScopes(); if (!perms.isEmpty()) { Modified: cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/ImplicitGrantService.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/ImplicitGrantService.java?rev=1416602&r1=1416601&r2=1416602&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/ImplicitGrantService.java (original) +++ cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/ImplicitGrantService.java Mon Dec 3 18:01:03 2012 @@ -79,9 +79,11 @@ public class ImplicitGrantService extend sb.append(OAuthConstants.ACCESS_TOKEN).append("=").append(token.getTokenKey()); sb.append("&") .append(OAuthConstants.ACCESS_TOKEN_TYPE).append("=").append(token.getTokenType()); - //TODO: token parameters should also be included probably - // though it's not obvious the embedded client can deal with - // MAC tokens or other sophisticated tokens + if (isWriteOptionalParameters()) { + sb.append("&").append(OAuthConstants.ACCESS_TOKEN_EXPIRES_IN) + .append("=").append(token.getExpiresIn()); + //TODO: also report the approved scope and other parameters if any + } return Response.seeOther(URI.create(sb.toString())).build(); }