You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/04/03 21:44:12 UTC

[GitHub] [calcite-avatica] joshelser commented on a change in pull request #92: [WIP][CALCITE-2972] Upgrade jetty to 9.4.15.v20190215

joshelser commented on a change in pull request #92: [WIP][CALCITE-2972] Upgrade jetty to 9.4.15.v20190215
URL: https://github.com/apache/calcite-avatica/pull/92#discussion_r271945158
 
 

 ##########
 File path: server/src/main/java/org/apache/calcite/avatica/server/HttpServer.java
 ##########
 @@ -337,17 +343,23 @@ protected ConstraintSecurityHandler configureSpnego(Server server,
       AvaticaServerConfiguration config) {
     final String realm = Objects.requireNonNull(config.getKerberosRealm());
     final String principal = Objects.requireNonNull(config.getKerberosPrincipal());
-
-    // A customization of SpnegoLoginService to explicitly set the server's principal, otherwise
-    // we would have to require a custom file to set the server's principal.
-    PropertyBasedSpnegoLoginService spnegoLoginService =
-        new PropertyBasedSpnegoLoginService(realm, principal);
+    final String principalWithoutRealm = principal.split("@", 2)[0];
+    final String[] principalParts = principalWithoutRealm.split("/", 2);
+    final String serviceName = principalParts[0];
+    final String hostname = principalParts[1];
+    final Path keytabPath = config.getKerberosKeytab();
+
+    ConfigurableSpnegoLoginService spnegoLoginService =
+        new ConfigurableSpnegoLoginService(realm, new TestAuthorizationService());
+    spnegoLoginService.setServiceName(serviceName);
+    spnegoLoginService.setHostName(hostname);
+    spnegoLoginService.setKeyTabPath(keytabPath);
 
 Review comment:
   Ugh. That's going to make unit testing harder.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services