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-812 - WebSSOResource doesn't make use of target audiences
Date Wed, 14 Dec 2016 00:23:42 GMT
Repository: knox
Updated Branches:
  refs/heads/master 5b0dde2bb -> f1d0ab8b5


KNOX-812 - WebSSOResource doesn't make use of target audiences

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

Branch: refs/heads/master
Commit: f1d0ab8b57e79e401e8dd9b4232843d057dd7722
Parents: 5b0dde2
Author: Larry McCay <lmccay@hortonworks.com>
Authored: Tue Dec 13 19:23:33 2016 -0500
Committer: Larry McCay <lmccay@hortonworks.com>
Committed: Tue Dec 13 19:23:33 2016 -0500

----------------------------------------------------------------------
 .../hadoop/gateway/service/knoxsso/WebSSOResource.java | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/f1d0ab8b/gateway-service-knoxsso/src/main/java/org/apache/hadoop/gateway/service/knoxsso/WebSSOResource.java
----------------------------------------------------------------------
diff --git a/gateway-service-knoxsso/src/main/java/org/apache/hadoop/gateway/service/knoxsso/WebSSOResource.java
b/gateway-service-knoxsso/src/main/java/org/apache/hadoop/gateway/service/knoxsso/WebSSOResource.java
index 977ffaf..20c6534 100644
--- a/gateway-service-knoxsso/src/main/java/org/apache/hadoop/gateway/service/knoxsso/WebSSOResource.java
+++ b/gateway-service-knoxsso/src/main/java/org/apache/hadoop/gateway/service/knoxsso/WebSSOResource.java
@@ -21,6 +21,7 @@ import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.security.Principal;
+import java.util.ArrayList;
 
 import javax.annotation.PostConstruct;
 import javax.servlet.ServletContext;
@@ -175,7 +176,17 @@ public class WebSSOResource {
     Principal p = ((HttpServletRequest)request).getUserPrincipal();
 
     try {
-      JWT token = ts.issueToken(p, "RS256", getExpiry());
+      JWT token = null;
+      if (targetAudiences == null || targetAudiences.length == 0) {
+        token = ts.issueToken(p, "RS256", getExpiry());
+      } else {
+        ArrayList<String> aud = new ArrayList<String>();
+        for (int i = 0; i < targetAudiences.length; i++) {
+          aud.add(targetAudiences[i]);
+        }
+        token = ts.issueToken(p, aud, "RS256", getExpiry());
+      }
+
       // Coverity CID 1327959
       if( token != null ) {
         addJWTHadoopCookie( original, token );


Mime
View raw message