cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1567600 - in /cxf/trunk/rt/rs/security/oauth-parent/oauth2/src: main/java/org/apache/cxf/rs/security/oauth2/client/ main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/ main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/ main/java/...
Date Wed, 12 Feb 2014 11:15:57 GMT
Author: sergeyb
Date: Wed Feb 12 11:15:56 2014
New Revision: 1567600

URL: http://svn.apache.org/r1567600
Log:
[CXF-5557] Support for Hawk

Added:
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/HawkAccessToken.java
      - copied, changed from r1567073, cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/MacAccessToken.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/HawkAccessTokenValidator.java
      - copied, changed from r1567073, cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/MacAccessTokenValidator.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/HawkAuthorizationScheme.java
      - copied, changed from r1567073, cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/MacAuthorizationScheme.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/Nonce.java
      - copied, changed from r1567073, cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/Nonce.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceHistory.java
      - copied, changed from r1567073, cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/NonceHistory.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceStore.java
      - copied, changed from r1567073, cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/NonceStore.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceVerifier.java
      - copied, changed from r1567073, cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/NonceVerifier.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceVerifierImpl.java
      - copied, changed from r1567073, cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/NonceVerifierImpl.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/HmacAlgorithm.java
      - copied, changed from r1567073, cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/HmacAlgorithm.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/HmacUtils.java
      - copied, changed from r1567073, cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/HmacUtils.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/tokens/
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/HawkAccessTokenValidatorTest.java
      - copied, changed from r1567073, cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/token/mac/MacAccessTokenValidatorTest.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceVerifierImplTest.java
      - copied, changed from r1567073, cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/token/mac/NonceVerifierImplTest.java
Removed:
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/token/
Modified:
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/OAuthClientUtils.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthConstants.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/provider/OAuthJSONProviderTest.java

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/OAuthClientUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/OAuthClientUtils.java?rev=1567600&r1=1567599&r2=1567600&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/OAuthClientUtils.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/OAuthClientUtils.java
Wed Feb 12 11:15:56 2014
@@ -37,7 +37,7 @@ import org.apache.cxf.rs.security.oauth2
 import org.apache.cxf.rs.security.oauth2.common.OAuthError;
 import org.apache.cxf.rs.security.oauth2.provider.OAuthJSONProvider;
 import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;
-import org.apache.cxf.rs.security.oauth2.tokens.mac.MacAuthorizationScheme;
+import org.apache.cxf.rs.security.oauth2.tokens.hawk.HawkAuthorizationScheme;
 import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
 
 /**
@@ -359,13 +359,13 @@ public final class OAuthClientUtils {
             sb.append(OAuthConstants.BEARER_AUTHORIZATION_SCHEME);
             sb.append(" ");
             sb.append(token.getTokenKey());
-        } else if (OAuthConstants.MAC_TOKEN_TYPE.equals(token.getTokenType())) {
+        } else if (OAuthConstants.HAWK_TOKEN_TYPE.equals(token.getTokenType())) {
             if (httpProps == null) {
                 throw new IllegalArgumentException("MAC scheme requires HTTP Request properties");
             }
-            MacAuthorizationScheme macAuthData = new MacAuthorizationScheme(httpProps, token);
-            String macAlgo = token.getParameters().get(OAuthConstants.MAC_TOKEN_ALGORITHM);
-            String macKey = token.getParameters().get(OAuthConstants.MAC_TOKEN_KEY);
+            HawkAuthorizationScheme macAuthData = new HawkAuthorizationScheme(httpProps,
token);
+            String macAlgo = token.getParameters().get(OAuthConstants.HAWK_TOKEN_ALGORITHM);
+            String macKey = token.getParameters().get(OAuthConstants.HAWK_TOKEN_KEY);
             sb.append(macAuthData.toAuthorizationHeader(macAlgo, macKey));
         } else {
             throw new ProcessingException(new OAuthServiceException("Unsupported token type"));

Copied: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/HawkAccessToken.java
(from r1567073, cxf/trunk/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/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/HawkAccessToken.java?p2=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/HawkAccessToken.java&p1=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/MacAccessToken.java&r1=1567073&r2=1567600&rev=1567600&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/MacAccessToken.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/HawkAccessToken.java
Wed Feb 12 11:15:56 2014
@@ -16,30 +16,35 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.rs.security.oauth2.tokens.mac;
+package org.apache.cxf.rs.security.oauth2.tokens.hawk;
 
 import org.apache.cxf.rs.security.oauth2.common.Client;
 import org.apache.cxf.rs.security.oauth2.common.ServerAccessToken;
+import org.apache.cxf.rs.security.oauth2.utils.HmacAlgorithm;
+import org.apache.cxf.rs.security.oauth2.utils.HmacUtils;
 import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
 import org.apache.cxf.rs.security.oauth2.utils.OAuthUtils;
 
-//See http://tools.ietf.org/html/draft-ietf-oauth-v2-http-mac-01
-public class MacAccessToken extends ServerAccessToken {
+//https://tools.ietf.org/html/draft-hammer-oauth-v2-mac-token-05
+//->
+//https://github.com/hueniverse/hawk/blob/master/README.md
+
+public class HawkAccessToken extends ServerAccessToken {
     
     private static final long serialVersionUID = -4331703769692080818L;
 
-    public MacAccessToken(Client client, 
+    public HawkAccessToken(Client client, 
                           long lifetime) {
         this(client, HmacAlgorithm.HmacSHA256, lifetime);
     }
     
-    public MacAccessToken(Client client, 
+    public HawkAccessToken(Client client, 
                           String macAuthAlgo,
                           long lifetime) {
         this(client, HmacAlgorithm.toHmacAlgorithm(macAuthAlgo), lifetime);
     }
     
-    public MacAccessToken(Client client, 
+    public HawkAccessToken(Client client, 
                           HmacAlgorithm macAlgo,
                           long lifetime) {
         this(client, 
@@ -48,34 +53,34 @@ public class MacAccessToken extends Serv
              lifetime, 
              OAuthUtils.getIssuedAt());
     }
-    public MacAccessToken(Client client,
+    public HawkAccessToken(Client client,
                           HmacAlgorithm algo,
                           String tokenKey,
                           long lifetime, 
                           long issuedAt) {
-        super(client, OAuthConstants.MAC_TOKEN_TYPE, tokenKey, lifetime, issuedAt);
+        super(client, OAuthConstants.HAWK_TOKEN_TYPE, tokenKey, lifetime, issuedAt);
         this.setExtraParameters(algo, null);
     }
     
-    public MacAccessToken(Client client,
+    public HawkAccessToken(Client client,
                           HmacAlgorithm algo,
                           String tokenKey,
                           String macKey,
                           long lifetime, 
                           long issuedAt) {
-        super(client, OAuthConstants.MAC_TOKEN_TYPE, tokenKey, lifetime, issuedAt);
+        super(client, OAuthConstants.HAWK_TOKEN_TYPE, tokenKey, lifetime, issuedAt);
         this.setExtraParameters(algo, macKey);
     }
     
-    public MacAccessToken(ServerAccessToken token, String newKey) {
-        super(validateTokenType(token, OAuthConstants.MAC_TOKEN_TYPE), newKey);
+    public HawkAccessToken(ServerAccessToken token, String newKey) {
+        super(validateTokenType(token, OAuthConstants.HAWK_TOKEN_TYPE), newKey);
     }
     
     private void setExtraParameters(HmacAlgorithm algo, String macKey) {
         String theKey = macKey == null ? HmacUtils.generateSecret(algo) : macKey; 
-        super.getParameters().put(OAuthConstants.MAC_TOKEN_KEY,
+        super.getParameters().put(OAuthConstants.HAWK_TOKEN_KEY,
                                   theKey);
-        super.getParameters().put(OAuthConstants.MAC_TOKEN_ALGORITHM,
+        super.getParameters().put(OAuthConstants.HAWK_TOKEN_ALGORITHM,
                                   algo.getOAuthName());
     }
     
@@ -84,10 +89,10 @@ public class MacAccessToken extends Serv
     }
     
     public String getMacKey() {
-        return super.getParameters().get(OAuthConstants.MAC_TOKEN_KEY);
+        return super.getParameters().get(OAuthConstants.HAWK_TOKEN_KEY);
     }
     
     public String getMacAlgorithm() {
-        return super.getParameters().get(OAuthConstants.MAC_TOKEN_ALGORITHM);
+        return super.getParameters().get(OAuthConstants.HAWK_TOKEN_ALGORITHM);
     }
 }

Copied: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/HawkAccessTokenValidator.java
(from r1567073, cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/MacAccessTokenValidator.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/HawkAccessTokenValidator.java?p2=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/HawkAccessTokenValidator.java&p1=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/MacAccessTokenValidator.java&r1=1567073&r2=1567600&rev=1567600&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/MacAccessTokenValidator.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/HawkAccessTokenValidator.java
Wed Feb 12 11:15:56 2014
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.rs.security.oauth2.tokens.mac;
+package org.apache.cxf.rs.security.oauth2.tokens.hawk;
 
 import java.util.Arrays;
 import java.util.Collections;
@@ -34,14 +34,16 @@ import org.apache.cxf.rs.security.oauth2
 import org.apache.cxf.rs.security.oauth2.provider.OAuthDataProvider;
 import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;
 import org.apache.cxf.rs.security.oauth2.utils.AuthorizationUtils;
+import org.apache.cxf.rs.security.oauth2.utils.HmacAlgorithm;
+import org.apache.cxf.rs.security.oauth2.utils.HmacUtils;
 import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
 
-public class MacAccessTokenValidator implements AccessTokenValidator {
+public class HawkAccessTokenValidator implements AccessTokenValidator {
     private OAuthDataProvider dataProvider;
     private NonceVerifier nonceVerifier;
     
     public List<String> getSupportedAuthorizationSchemes() {
-        return Collections.singletonList(OAuthConstants.MAC_AUTHORIZATION_SCHEME);
+        return Collections.singletonList(OAuthConstants.HAWK_AUTHORIZATION_SCHEME);
     }
 
     public AccessTokenValidation validateAccessToken(MessageContext mc,
@@ -50,10 +52,10 @@ public class MacAccessTokenValidator imp
         HttpRequestProperties httpProps = new HttpRequestProperties(mc.getUriInfo().getRequestUri(),
                                                                     mc.getHttpServletRequest().getMethod());

         Map<String, String> schemeParams = getSchemeParameters(authSchemeData);
-        MacAuthorizationScheme macAuthInfo = new MacAuthorizationScheme(httpProps, schemeParams);
+        HawkAuthorizationScheme macAuthInfo = new HawkAuthorizationScheme(httpProps, schemeParams);
         
-        MacAccessToken macAccessToken = validateSchemeData(macAuthInfo,
-                                                           schemeParams.get(OAuthConstants.MAC_TOKEN_SIGNATURE));
+        HawkAccessToken macAccessToken = validateSchemeData(macAuthInfo,
+                                                           schemeParams.get(OAuthConstants.HAWK_TOKEN_SIGNATURE));
         validateTimestampNonce(macAccessToken, macAuthInfo.getTimestamp(), macAuthInfo.getNonce());
         return new AccessTokenValidation(macAccessToken);
     }
@@ -68,22 +70,21 @@ public class MacAccessTokenValidator imp
         return attributeMap;
     }
     
-    protected void validateTimestampNonce(MacAccessToken token, String ts, String nonce)
{
-        // (http://tools.ietf.org/html/draft-ietf-oauth-v2-http-mac-01#section-4.1)
+    protected void validateTimestampNonce(HawkAccessToken token, String ts, String nonce)
{
         if (nonceVerifier != null) {
             nonceVerifier.verifyNonce(token.getTokenKey(), nonce, ts);
         }
     }
     
-    private MacAccessToken validateSchemeData(MacAuthorizationScheme macAuthInfo,
+    private HawkAccessToken validateSchemeData(HawkAuthorizationScheme macAuthInfo,
                                               String clientMacString) {
         String macKey = macAuthInfo.getMacKey();
         
         ServerAccessToken accessToken = dataProvider.getAccessToken(macKey);
-        if (!(accessToken instanceof MacAccessToken)) {
+        if (!(accessToken instanceof HawkAccessToken)) {
             throw new OAuthServiceException(OAuthConstants.SERVER_ERROR);
         }
-        MacAccessToken macAccessToken = (MacAccessToken)accessToken;
+        HawkAccessToken macAccessToken = (HawkAccessToken)accessToken;
         
         String normalizedString = macAuthInfo.getNormalizedRequestString();
         try {
@@ -95,7 +96,7 @@ public class MacAccessTokenValidator imp
             boolean validMac = Arrays.equals(serverMacData, clientMacData);
             if (!validMac) {
                 AuthorizationUtils.throwAuthorizationFailure(Collections
-                    .singleton(OAuthConstants.MAC_AUTHORIZATION_SCHEME));
+                    .singleton(OAuthConstants.HAWK_AUTHORIZATION_SCHEME));
             }
         } catch (Base64Exception e) {
             throw new OAuthServiceException(OAuthConstants.SERVER_ERROR, e);

Copied: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/HawkAuthorizationScheme.java
(from r1567073, cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/MacAuthorizationScheme.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/HawkAuthorizationScheme.java?p2=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/HawkAuthorizationScheme.java&p1=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/MacAuthorizationScheme.java&r1=1567073&r2=1567600&rev=1567600&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/MacAuthorizationScheme.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/HawkAuthorizationScheme.java
Wed Feb 12 11:15:56 2014
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.rs.security.oauth2.tokens.mac;
+package org.apache.cxf.rs.security.oauth2.tokens.hawk;
 
 import java.security.SecureRandom;
 import java.util.Map;
@@ -25,9 +25,12 @@ import org.apache.cxf.common.util.Base64
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.rs.security.oauth2.client.HttpRequestProperties;
 import org.apache.cxf.rs.security.oauth2.common.AccessToken;
+import org.apache.cxf.rs.security.oauth2.utils.HmacUtils;
 import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
-
-public class MacAuthorizationScheme {
+// https://tools.ietf.org/html/draft-hammer-oauth-v2-mac-token-05
+// ->
+// https://github.com/hueniverse/hawk/blob/master/README.md
+public class HawkAuthorizationScheme {
     private static final String SEPARATOR = "\n";
     
     private HttpRequestProperties props;
@@ -35,7 +38,7 @@ public class MacAuthorizationScheme {
     private String timestamp;
     private String nonce;
     
-    public MacAuthorizationScheme(HttpRequestProperties props,
+    public HawkAuthorizationScheme(HttpRequestProperties props,
                                   AccessToken token) {
         this.props = props;
         this.macKey = token.getTokenKey();
@@ -43,12 +46,12 @@ public class MacAuthorizationScheme {
         this.nonce = generateNonce();
     }
     
-    public MacAuthorizationScheme(HttpRequestProperties props,
+    public HawkAuthorizationScheme(HttpRequestProperties props,
                                   Map<String, String> schemeParams) {
         this.props = props;
-        this.macKey = schemeParams.get(OAuthConstants.MAC_TOKEN_ID);
-        this.timestamp = schemeParams.get(OAuthConstants.MAC_TOKEN_TIMESTAMP);
-        this.nonce = schemeParams.get(OAuthConstants.MAC_TOKEN_NONCE);
+        this.macKey = schemeParams.get(OAuthConstants.HAWK_TOKEN_ID);
+        this.timestamp = schemeParams.get(OAuthConstants.HAWK_TOKEN_TIMESTAMP);
+        this.nonce = schemeParams.get(OAuthConstants.HAWK_TOKEN_NONCE);
     }
     
     public String getMacKey() {
@@ -69,12 +72,11 @@ public class MacAuthorizationScheme {
         String signature = HmacUtils.computeSignature(macAlgo, macSecret, data);
         
         StringBuilder sb = new StringBuilder();
-        sb.append(OAuthConstants.MAC_AUTHORIZATION_SCHEME).append(" ");
-        addParameter(sb, OAuthConstants.MAC_TOKEN_ID, macKey, false);
-        addParameter(sb, OAuthConstants.MAC_TOKEN_NONCE, nonce, false);
-        addParameter(sb, OAuthConstants.MAC_TOKEN_SIGNATURE, signature, false);
-        addParameter(sb, OAuthConstants.MAC_TOKEN_TIMESTAMP, timestamp, true);
-        
+        sb.append(OAuthConstants.HAWK_AUTHORIZATION_SCHEME).append(" ");
+        addParameter(sb, OAuthConstants.HAWK_TOKEN_ID, macKey, false);
+        addParameter(sb, OAuthConstants.HAWK_TOKEN_TIMESTAMP, timestamp, false);
+        addParameter(sb, OAuthConstants.HAWK_TOKEN_NONCE, nonce, false);
+        addParameter(sb, OAuthConstants.HAWK_TOKEN_SIGNATURE, signature, true);
         
         return sb.toString();
     }
@@ -100,6 +102,7 @@ public class MacAuthorizationScheme {
             + requestURI + SEPARATOR 
             + props.getHostName() + SEPARATOR 
             + props.getPort() + SEPARATOR
+            + "" + SEPARATOR
             + "" + SEPARATOR;
 
         return value;

Copied: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/Nonce.java
(from r1567073, cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/Nonce.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/Nonce.java?p2=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/Nonce.java&p1=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/Nonce.java&r1=1567073&r2=1567600&rev=1567600&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/Nonce.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/Nonce.java
Wed Feb 12 11:15:56 2014
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.rs.security.oauth2.tokens.mac;
+package org.apache.cxf.rs.security.oauth2.tokens.hawk;
 
 import java.io.Serializable;
 

Copied: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceHistory.java
(from r1567073, cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/NonceHistory.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceHistory.java?p2=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceHistory.java&p1=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/NonceHistory.java&r1=1567073&r2=1567600&rev=1567600&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/NonceHistory.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceHistory.java
Wed Feb 12 11:15:56 2014
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.rs.security.oauth2.tokens.mac;
+package org.apache.cxf.rs.security.oauth2.tokens.hawk;
 
 import java.io.Serializable;
 import java.util.ArrayList;

Copied: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceStore.java
(from r1567073, cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/NonceStore.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceStore.java?p2=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceStore.java&p1=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/NonceStore.java&r1=1567073&r2=1567600&rev=1567600&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/NonceStore.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceStore.java
Wed Feb 12 11:15:56 2014
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.rs.security.oauth2.tokens.mac;
+package org.apache.cxf.rs.security.oauth2.tokens.hawk;
 
 public interface NonceStore {
 

Copied: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceVerifier.java
(from r1567073, cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/NonceVerifier.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceVerifier.java?p2=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceVerifier.java&p1=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/NonceVerifier.java&r1=1567073&r2=1567600&rev=1567600&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/NonceVerifier.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceVerifier.java
Wed Feb 12 11:15:56 2014
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.rs.security.oauth2.tokens.mac;
+package org.apache.cxf.rs.security.oauth2.tokens.hawk;
 
 import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;
 

Copied: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceVerifierImpl.java
(from r1567073, cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/NonceVerifierImpl.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceVerifierImpl.java?p2=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceVerifierImpl.java&p1=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/NonceVerifierImpl.java&r1=1567073&r2=1567600&rev=1567600&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/NonceVerifierImpl.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceVerifierImpl.java
Wed Feb 12 11:15:56 2014
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.rs.security.oauth2.tokens.mac;
+package org.apache.cxf.rs.security.oauth2.tokens.hawk;
 
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;

Copied: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/HmacAlgorithm.java
(from r1567073, cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/HmacAlgorithm.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/HmacAlgorithm.java?p2=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/HmacAlgorithm.java&p1=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/HmacAlgorithm.java&r1=1567073&r2=1567600&rev=1567600&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/HmacAlgorithm.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/HmacAlgorithm.java
Wed Feb 12 11:15:56 2014
@@ -17,13 +17,12 @@
  * under the License.
  */
 
-package org.apache.cxf.rs.security.oauth2.tokens.mac;
+package org.apache.cxf.rs.security.oauth2.utils;
 
-import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
 
 public enum HmacAlgorithm {
-    HmacSHA1(OAuthConstants.MAC_TOKEN_ALGO_HMAC_SHA_1),
-    HmacSHA256(OAuthConstants.MAC_TOKEN_ALGO_HMAC_SHA_256);
+    HmacSHA1(HmacUtils.ALGO_HMAC_SHA_1),
+    HmacSHA256(HmacUtils.ALGO_HMAC_SHA_256);
 
     private final String oauthName;
 
@@ -40,10 +39,10 @@ public enum HmacAlgorithm {
     }
 
     public static HmacAlgorithm toHmacAlgorithm(String value) {
-        if (OAuthConstants.MAC_TOKEN_ALGO_HMAC_SHA_1.equals(value)) {
+        if (HmacUtils.ALGO_HMAC_SHA_1.equals(value)) {
             return HmacSHA1;
         }
-        if (OAuthConstants.MAC_TOKEN_ALGO_HMAC_SHA_256.equals(value)) {
+        if (HmacUtils.ALGO_HMAC_SHA_256.equals(value)) {
             return HmacSHA256;
         }
         return null;

Copied: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/HmacUtils.java
(from r1567073, cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/HmacUtils.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/HmacUtils.java?p2=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/HmacUtils.java&p1=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/HmacUtils.java&r1=1567073&r2=1567600&rev=1567600&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/tokens/mac/HmacUtils.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/HmacUtils.java
Wed Feb 12 11:15:56 2014
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.rs.security.oauth2.tokens.mac;
+package org.apache.cxf.rs.security.oauth2.utils;
 
 import java.io.UnsupportedEncodingException;
 import java.security.InvalidKeyException;
@@ -28,18 +28,18 @@ import javax.crypto.spec.SecretKeySpec;
 
 import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;
-import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
 
 public final class HmacUtils {
+    public static final String ALGO_HMAC_SHA_1 = "hmac-sha-1";
+    public static final String ALGO_HMAC_SHA_256 = "hmac-sha-256";
+    
     private HmacUtils() {
         
     }
     
     public static String computeSignature(String macAlgoOAuthName, String macSecret, String
data) {
         HmacAlgorithm theAlgo = HmacAlgorithm.toHmacAlgorithm(macAlgoOAuthName);
-        return HmacUtils.computeHmacString(macSecret, 
-                                           theAlgo.getJavaName(), 
-                                           data);
+        return computeHmacString(macSecret, theAlgo.getJavaName(), data);
     }
     
     /**

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthConstants.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthConstants.java?rev=1567600&r1=1567599&r2=1567600&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthConstants.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthConstants.java
Wed Feb 12 11:15:56 2014
@@ -50,7 +50,7 @@ public final class OAuthConstants {
     
     // Well-known token types
     public static final String BEARER_TOKEN_TYPE = "bearer";
-    public static final String MAC_TOKEN_TYPE = "mac";
+    public static final String HAWK_TOKEN_TYPE = "hawk";
     
     // http://datatracker.ietf.org/doc/draft-sakimura-oauth-tcse
     public static final String AUTHORIZATION_CODE_VERIFIER = "code_verifier";
@@ -61,21 +61,19 @@ public final class OAuthConstants {
         
     // MAC token parameters
     // Set by Access Token Service
-    public static final String MAC_TOKEN_KEY = "mac_key";
-    public static final String MAC_TOKEN_ALGORITHM = "mac_algorithm";
-    public static final String MAC_TOKEN_ALGO_HMAC_SHA_1 = "hmac-sha-1";
-    public static final String MAC_TOKEN_ALGO_HMAC_SHA_256 = "hmac-sha-256";
+    public static final String HAWK_TOKEN_KEY = "secret";
+    public static final String HAWK_TOKEN_ALGORITHM = "algorithm";
     
     // Set in Authorization header
-    public static final String MAC_TOKEN_ID = "id";
-    public static final String MAC_TOKEN_TIMESTAMP = "ts";
-    public static final String MAC_TOKEN_EXTENSION = "ext";
-    public static final String MAC_TOKEN_NONCE = "nonce";
-    public static final String MAC_TOKEN_SIGNATURE = "mac";
+    public static final String HAWK_TOKEN_ID = "id";
+    public static final String HAWK_TOKEN_TIMESTAMP = "ts";
+    public static final String HAWK_TOKEN_EXTENSION = "ext";
+    public static final String HAWK_TOKEN_NONCE = "nonce";
+    public static final String HAWK_TOKEN_SIGNATURE = "mac";
     
     // Token Authorization schemes
     public static final String BEARER_AUTHORIZATION_SCHEME = "Bearer";
-    public static final String MAC_AUTHORIZATION_SCHEME = "MAC";
+    public static final String HAWK_AUTHORIZATION_SCHEME = "Hawk";
     public static final String ALL_AUTH_SCHEMES = "*";
 
     

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/provider/OAuthJSONProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/provider/OAuthJSONProviderTest.java?rev=1567600&r1=1567599&r2=1567600&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/provider/OAuthJSONProviderTest.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/provider/OAuthJSONProviderTest.java
Wed Feb 12 11:15:56 2014
@@ -29,6 +29,7 @@ import javax.ws.rs.core.MediaType;
 
 import org.apache.cxf.jaxrs.impl.MetadataMap;
 import org.apache.cxf.rs.security.oauth2.common.ClientAccessToken;
+import org.apache.cxf.rs.security.oauth2.utils.HmacUtils;
 import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
 
 import org.junit.Assert;
@@ -101,14 +102,14 @@ public class OAuthJSONProviderTest exten
     }
     
     @Test
-    public void testWriteMacClientAccessToken() throws Exception {
-        ClientAccessToken token = new ClientAccessToken("mac", "1234");
+    public void testWriteHawkClientAccessToken() throws Exception {
+        ClientAccessToken token = new ClientAccessToken("hawk", "1234");
         token.setExpiresIn(12345);
         token.setRefreshToken("5678");
         token.setApprovedScope("read");
         Map<String, String> params = new LinkedHashMap<String, String>();
-        params.put(OAuthConstants.MAC_TOKEN_KEY, "test_mac_secret");
-        params.put(OAuthConstants.MAC_TOKEN_ALGORITHM, OAuthConstants.MAC_TOKEN_ALGO_HMAC_SHA_1);
+        params.put(OAuthConstants.HAWK_TOKEN_KEY, "test_mac_secret");
+        params.put(OAuthConstants.HAWK_TOKEN_ALGORITHM, HmacUtils.ALGO_HMAC_SHA_1);
         params.put("my_parameter", "http://abc");
         
         token.setParameters(params);
@@ -118,22 +119,22 @@ public class OAuthJSONProviderTest exten
         provider.writeTo(token, ClientAccessToken.class, ClientAccessToken.class, new Annotation[]
{},
                          MediaType.APPLICATION_JSON_TYPE, new MetadataMap<String, Object>(),
bos);
         doReadClientAccessToken(bos.toString(), 
-                                OAuthConstants.MAC_TOKEN_TYPE,
+                                OAuthConstants.HAWK_TOKEN_TYPE,
                                 params);
         
     }
     
     @Test
-    public void testReadMacClientAccessToken() throws Exception {
-        String response = "{" + "\"access_token\":\"1234\"," + "\"token_type\":\"mac\","
+    public void testReadHawkClientAccessToken() throws Exception {
+        String response = "{" + "\"access_token\":\"1234\"," + "\"token_type\":\"hawk\","
             + "\"refresh_token\":\"5678\"," + "\"expires_in\":12345," + "\"scope\":\"read\","
-            + "\"mac_key\":\"adijq39jdlaska9asud\"," + "\"mac_algorithm\":\"hmac-sha-256\","
+            + "\"secret\":\"adijq39jdlaska9asud\"," + "\"algorithm\":\"hmac-sha-256\","
             + "\"my_parameter\":\"http://abc\"" + "}";
-        ClientAccessToken macToken = doReadClientAccessToken(response, "mac", null);
+        ClientAccessToken macToken = doReadClientAccessToken(response, "hawk", null);
         assertEquals("adijq39jdlaska9asud", 
-                     macToken.getParameters().get(OAuthConstants.MAC_TOKEN_KEY));
+                     macToken.getParameters().get(OAuthConstants.HAWK_TOKEN_KEY));
         assertEquals("hmac-sha-256",
-                     macToken.getParameters().get(OAuthConstants.MAC_TOKEN_ALGORITHM));
+                     macToken.getParameters().get(OAuthConstants.HAWK_TOKEN_ALGORITHM));
     }
     
 }

Copied: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/HawkAccessTokenValidatorTest.java
(from r1567073, cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/token/mac/MacAccessTokenValidatorTest.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/HawkAccessTokenValidatorTest.java?p2=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/HawkAccessTokenValidatorTest.java&p1=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/token/mac/MacAccessTokenValidatorTest.java&r1=1567073&r2=1567600&rev=1567600&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/token/mac/MacAccessTokenValidatorTest.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/HawkAccessTokenValidatorTest.java
Wed Feb 12 11:15:56 2014
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.rs.security.oauth2.token.mac;
+package org.apache.cxf.rs.security.oauth2.tokens.hawk;
 
 import java.net.URI;
 
@@ -28,10 +28,7 @@ import org.apache.cxf.rs.security.oauth2
 import org.apache.cxf.rs.security.oauth2.common.AccessTokenValidation;
 import org.apache.cxf.rs.security.oauth2.common.Client;
 import org.apache.cxf.rs.security.oauth2.provider.OAuthDataProvider;
-import org.apache.cxf.rs.security.oauth2.tokens.mac.HmacAlgorithm;
-import org.apache.cxf.rs.security.oauth2.tokens.mac.MacAccessToken;
-import org.apache.cxf.rs.security.oauth2.tokens.mac.MacAccessTokenValidator;
-import org.apache.cxf.rs.security.oauth2.tokens.mac.MacAuthorizationScheme;
+import org.apache.cxf.rs.security.oauth2.utils.HmacAlgorithm;
 import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
 import org.easymock.EasyMock;
 
@@ -39,9 +36,9 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
-public class MacAccessTokenValidatorTest extends Assert {
+public class HawkAccessTokenValidatorTest extends Assert {
 
-    private MacAccessTokenValidator validator = new MacAccessTokenValidator();
+    private HawkAccessTokenValidator validator = new HawkAccessTokenValidator();
     private OAuthDataProvider dataProvider = EasyMock.createMock(OAuthDataProvider.class);
     private MessageContext messageContext = EasyMock.createMock(MessageContext.class);
     
@@ -52,7 +49,7 @@ public class MacAccessTokenValidatorTest
     
     @Test
     public void testValidateAccessToken() throws Exception {
-        MacAccessToken macAccessToken = new MacAccessToken(new Client("testClientId", "testClientSecret",
+        HawkAccessToken macAccessToken = new HawkAccessToken(new Client("testClientId", "testClientSecret",
                                                                           false), 
                                                                           HmacAlgorithm.HmacSHA256,
-1);
         HttpServletRequest httpRequest = mockHttpRequest();
@@ -66,17 +63,17 @@ public class MacAccessTokenValidatorTest
         String authData = getClientAuthHeader(macAccessToken);
         AccessTokenValidation tokenValidation = validator
             .validateAccessToken(messageContext, 
-                                 OAuthConstants.MAC_AUTHORIZATION_SCHEME, 
+                                 OAuthConstants.HAWK_AUTHORIZATION_SCHEME, 
                                  authData.split(" ")[1]);
         assertNotNull(tokenValidation);
         EasyMock.verify(dataProvider, messageContext, httpRequest);
     }
     
-    private static String getClientAuthHeader(MacAccessToken macAccessToken) {
+    private static String getClientAuthHeader(HawkAccessToken macAccessToken) {
         String address = "http://localhost:8080/appContext/oauth2/testResource";
         HttpRequestProperties props = new HttpRequestProperties(URI.create(address), "GET");
         
-        return new MacAuthorizationScheme(props, macAccessToken)
+        return new HawkAuthorizationScheme(props, macAccessToken)
             .toAuthorizationHeader(macAccessToken.getMacAlgorithm(),
                                    macAccessToken.getMacKey());
     }

Copied: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceVerifierImplTest.java
(from r1567073, cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/token/mac/NonceVerifierImplTest.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceVerifierImplTest.java?p2=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceVerifierImplTest.java&p1=cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/token/mac/NonceVerifierImplTest.java&r1=1567073&r2=1567600&rev=1567600&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/token/mac/NonceVerifierImplTest.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/tokens/hawk/NonceVerifierImplTest.java
Wed Feb 12 11:15:56 2014
@@ -16,13 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.rs.security.oauth2.token.mac;
+package org.apache.cxf.rs.security.oauth2.tokens.hawk;
 
 import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;
-import org.apache.cxf.rs.security.oauth2.tokens.mac.Nonce;
-import org.apache.cxf.rs.security.oauth2.tokens.mac.NonceHistory;
-import org.apache.cxf.rs.security.oauth2.tokens.mac.NonceStore;
-import org.apache.cxf.rs.security.oauth2.tokens.mac.NonceVerifierImpl;
 import org.easymock.EasyMock;
 
 import org.junit.Assert;



Mime
View raw message