cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1452237 - in /cxf/branches/2.7.x-fixes: ./ rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/grants/saml/
Date Mon, 04 Mar 2013 10:24:26 GMT
Author: sergeyb
Date: Mon Mar  4 10:24:26 2013
New Revision: 1452237

URL: http://svn.apache.org/r1452237
Log:
Merged revisions 1452102 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1452102 | sergeyb | 2013-03-03 19:00:46 +0000 (Sun, 03 Mar 2013) | 1 line
  
  Minor update to OAuth2 Saml code
........

Added:
    cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/grants/saml/AbstractSaml2BearerGrant.java
      - copied unchanged from r1452102, cxf/trunk/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/grants/saml/AbstractSaml2BearerGrant.java
    cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/grants/saml/SamlBearerClientCredentialsGrant.java
      - copied unchanged from r1452102, cxf/trunk/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/grants/saml/SamlBearerClientCredentialsGrant.java
Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/grants/saml/Saml2BearerGrant.java

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1452102

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/grants/saml/Saml2BearerGrant.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/grants/saml/Saml2BearerGrant.java?rev=1452237&r1=1452236&r2=1452237&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/grants/saml/Saml2BearerGrant.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/grants/saml/Saml2BearerGrant.java
Mon Mar  4 10:24:26 2013
@@ -20,18 +20,9 @@ package org.apache.cxf.rs.security.oauth
 
 import javax.ws.rs.core.MultivaluedMap;
 
-import org.apache.cxf.jaxrs.impl.MetadataMap;
-import org.apache.cxf.rs.security.oauth2.common.AccessTokenGrant;
-import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;
-import org.apache.cxf.rs.security.oauth2.saml.Base64UrlUtility;
 import org.apache.cxf.rs.security.oauth2.saml.Constants;
-import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
 
-public class Saml2BearerGrant implements AccessTokenGrant {
-    private String assertion;
-    private String scope;
-    private boolean encoded; 
-    
+public class Saml2BearerGrant extends AbstractSaml2BearerGrant {
     public Saml2BearerGrant(String assertion) {
         this(assertion, false);
     }
@@ -45,34 +36,13 @@ public class Saml2BearerGrant implements
     }
     
     public Saml2BearerGrant(String assertion, boolean encoded, String scope) {
-        this.assertion = assertion;
-        this.encoded = encoded;
-        this.scope = scope;
+        super(Constants.SAML2_BEARER_GRANT, assertion, encoded, scope);
     }
     
-    public String getType() {
-        return Constants.SAML2_BEARER_GRANT;
-    }
-
     public MultivaluedMap<String, String> toMap() {
-        MultivaluedMap<String, String> map = new MetadataMap<String, String>();
-        map.putSingle(OAuthConstants.GRANT_TYPE, Constants.SAML2_BEARER_GRANT);
+        MultivaluedMap<String, String> map = initMap();
         map.putSingle(Constants.CLIENT_GRANT_ASSERTION_PARAM, encodeAssertion());
-        if (scope != null) {
-            map.putSingle(OAuthConstants.SCOPE, scope);
-        }
+        addScope(map);
         return map;
     }
-
-    protected String encodeAssertion() {
-        if (encoded) {
-            return assertion;
-        }
-        
-        try {
-            return Base64UrlUtility.encode(assertion);
-        } catch (Exception ex) {
-            throw new OAuthServiceException(ex.getMessage(), ex);
-        }
-    }
 }



Mime
View raw message