knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lmc...@apache.org
Subject knox git commit: KNOX-610 - DefaultTokenService issueToken should never return null
Date Thu, 22 Oct 2015 15:42:30 GMT
Repository: knox
Updated Branches:
  refs/heads/master d6f6f6efc -> 58ffaf213


KNOX-610 - DefaultTokenService issueToken should never return null

Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/58ffaf21
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/58ffaf21
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/58ffaf21

Branch: refs/heads/master
Commit: 58ffaf2136bd065b5a6d74444611919cf15dad8a
Parents: d6f6f6e
Author: Larry McCay <lmccay@hortonworks.com>
Authored: Thu Oct 22 11:42:16 2015 -0400
Committer: Larry McCay <lmccay@hortonworks.com>
Committed: Thu Oct 22 11:42:16 2015 -0400

----------------------------------------------------------------------
 .../services/token/impl/DefaultTokenAuthorityService.java     | 5 ++---
 .../services/security/token/TokenServiceException.java        | 7 +++++++
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/58ffaf21/gateway-server/src/main/java/org/apache/hadoop/gateway/services/token/impl/DefaultTokenAuthorityService.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/services/token/impl/DefaultTokenAuthorityService.java
b/gateway-server/src/main/java/org/apache/hadoop/gateway/services/token/impl/DefaultTokenAuthorityService.java
index d28efa7..e5f5767 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/services/token/impl/DefaultTokenAuthorityService.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/services/token/impl/DefaultTokenAuthorityService.java
@@ -122,12 +122,11 @@ public class DefaultTokenAuthorityService implements JWTokenAuthority,
Service {
         JWSSigner signer = new RSASSASigner(key);
         token.sign(signer);
       } catch (KeystoreServiceException e) {
-        // TODO Auto-generated catch block
-        e.printStackTrace();
+        throw new TokenServiceException(e);
       }
     }
     else {
-      // log inappropriate alg
+      throw new TokenServiceException("Cannot issue token - Unsupported algorithm");
     }
     
     return token;

http://git-wip-us.apache.org/repos/asf/knox/blob/58ffaf21/gateway-spi/src/main/java/org/apache/hadoop/gateway/services/security/token/TokenServiceException.java
----------------------------------------------------------------------
diff --git a/gateway-spi/src/main/java/org/apache/hadoop/gateway/services/security/token/TokenServiceException.java
b/gateway-spi/src/main/java/org/apache/hadoop/gateway/services/security/token/TokenServiceException.java
index 90518b5..801de18 100644
--- a/gateway-spi/src/main/java/org/apache/hadoop/gateway/services/security/token/TokenServiceException.java
+++ b/gateway-spi/src/main/java/org/apache/hadoop/gateway/services/security/token/TokenServiceException.java
@@ -27,4 +27,11 @@ public class TokenServiceException extends Exception {
   public TokenServiceException(String message, Exception e) {
     super(message, e);
   }
+
+  /**
+   * 
+   */
+  public TokenServiceException(String message) {
+    super(message);
+  }
 }


Mime
View raw message