Repository: syncope
Updated Branches:
  refs/heads/master 991612c78 -> 4e7c36400


Get the signature algorithm from the signature provider rather than hardcoding 
to HS512 to allow the user to plug in other implementations


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/4e7c3640
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/4e7c3640
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/4e7c3640

Branch: refs/heads/master
Commit: 4e7c3640064a23af593dfbfa7f0ef5c0931c371a
Parents: 991612c
Author: Colm O hEigeartaigh <cohei...@apache.org>
Authored: Thu Jun 15 16:39:57 2017 +0100
Committer: Colm O hEigeartaigh <cohei...@apache.org>
Committed: Thu Jun 15 16:39:57 2017 +0100

----------------------------------------------------------------------
 .../provisioning/java/data/AccessTokenDataBinderImpl.java   | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/4e7c3640/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AccessTokenDataBinderImpl.java
----------------------------------------------------------------------
diff --git 
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AccessTokenDataBinderImpl.java
 
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AccessTokenDataBinderImpl.java
index 5159733..ae88565 100644
--- 
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AccessTokenDataBinderImpl.java
+++ 
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AccessTokenDataBinderImpl.java
@@ -27,7 +27,6 @@ import javax.annotation.Resource;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.commons.lang3.tuple.Triple;
 import org.apache.cxf.rs.security.jose.common.JoseType;
-import org.apache.cxf.rs.security.jose.jwa.SignatureAlgorithm;
 import org.apache.cxf.rs.security.jose.jws.JwsHeaders;
 import org.apache.cxf.rs.security.jose.jws.JwsJwtCompactConsumer;
 import org.apache.cxf.rs.security.jose.jws.JwsJwtCompactProducer;
@@ -61,8 +60,6 @@ public class AccessTokenDataBinderImpl implements 
AccessTokenDataBinder {
 
     private static final RandomBasedGenerator UUID_GENERATOR = 
Generators.randomBasedGenerator();
 
-    private static final JwsHeaders JWS_HEADERS = new JwsHeaders(JoseType.JWT, 
SignatureAlgorithm.HS512);
-
     @Resource(name = "adminUser")
     private String adminUser;
 
@@ -102,7 +99,8 @@ public class AccessTokenDataBinderImpl implements 
AccessTokenDataBinder {
             jwtClaims.setClaim(entry.getKey(), entry.getValue());
         }
 
-        JwtToken token = new JwtToken(JWS_HEADERS, jwtClaims);
+        JwsHeaders jwsHeaders = new JwsHeaders(JoseType.JWT, 
jwsSignatureProvider.getAlgorithm());
+        JwtToken token = new JwtToken(jwsHeaders, jwtClaims);
         JwsJwtCompactProducer producer = new JwsJwtCompactProducer(token);
 
         String signed = producer.signWith(jwsSignatureProvider);
@@ -169,7 +167,8 @@ public class AccessTokenDataBinderImpl implements 
AccessTokenDataBinder {
                 confDAO.find("jwt.lifetime.minutes", 
"120").getValues().get(0).getLongValue().intValue());
         consumer.getJwtClaims().setExpiryTime(expiry.getTime().getTime());
 
-        JwtToken token = new JwtToken(JWS_HEADERS, consumer.getJwtClaims());
+        JwsHeaders jwsHeaders = new JwsHeaders(JoseType.JWT, 
jwsSignatureProvider.getAlgorithm());
+        JwtToken token = new JwtToken(jwsHeaders, consumer.getJwtClaims());
         JwsJwtCompactProducer producer = new JwsJwtCompactProducer(token);
 
         String body = producer.signWith(jwsSignatureProvider);

Reply via email to