cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1376900 - in /cxf/branches/2.6.x-fixes: ./ rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/MacAccessToken.java
Date Fri, 24 Aug 2012 12:58:46 GMT
Author: sergeyb
Date: Fri Aug 24 12:58:46 2012
New Revision: 1376900

URL: http://svn.apache.org/viewvc?rev=1376900&view=rev
Log:
Merged revisions 1376897 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1376897 | sergeyb | 2012-08-24 13:45:41 +0100 (Fri, 24 Aug 2012) | 1 line
  
  Adding two more MAC token constructors
........

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/tokens/mac/MacAccessToken.java

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1376897

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/tokens/mac/MacAccessToken.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/tokens/mac/MacAccessToken.java?rev=1376900&r1=1376899&r2=1376900&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/MacAccessToken.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/MacAccessToken.java
Fri Aug 24 12:58:46 2012
@@ -24,6 +24,12 @@ import org.apache.cxf.rs.security.oauth2
 import org.apache.cxf.rs.security.oauth2.utils.OAuthUtils;
 
 public class MacAccessToken extends ServerAccessToken {
+    
+    public MacAccessToken(Client client, 
+                          long lifetime) {
+        this(client, HmacAlgorithm.HmacSHA256, lifetime);
+    }
+    
     public MacAccessToken(Client client, 
                           String macAuthAlgo,
                           long lifetime) {
@@ -45,12 +51,23 @@ public class MacAccessToken extends Serv
                           long lifetime, 
                           long issuedAt) {
         super(client, OAuthConstants.MAC_TOKEN_TYPE, tokenKey, lifetime, issuedAt);
-        this.setExtraParameters(algo);
+        this.setExtraParameters(algo, null);
+    }
+    
+    public MacAccessToken(Client client,
+                          HmacAlgorithm algo,
+                          String tokenKey,
+                          String tokenSecret,
+                          long lifetime, 
+                          long issuedAt) {
+        super(client, OAuthConstants.MAC_TOKEN_TYPE, tokenKey, lifetime, issuedAt);
+        this.setExtraParameters(algo, tokenSecret);
     }
     
-    private void setExtraParameters(HmacAlgorithm algo) {
+    private void setExtraParameters(HmacAlgorithm algo, String secret) {
+        String theSecret = secret == null ? HmacUtils.generateSecret(algo) : secret; 
         super.getParameters().put(OAuthConstants.MAC_TOKEN_SECRET,
-                                  HmacUtils.generateSecret(algo));
+                                  theSecret);
         super.getParameters().put(OAuthConstants.MAC_TOKEN_ALGORITHM,
                                   algo.getOAuthName());
     }



Mime
View raw message