[
https://issues.apache.org/jira/browse/KNOX-1962?focusedWorklogId=358892&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-358892
]
ASF GitHub Bot logged work on KNOX-1962:
----------------------------------------
Author: ASF GitHub Bot
Created on: 12/Dec/19 19:38
Start Date: 12/Dec/19 19:38
Worklog Time Spent: 10m
Work Description: risdenk commented on pull request #215: KNOX-1962 - CM
discovery - Avoid reading krb5 login config multiple t…
URL: https://github.com/apache/knox/pull/215#discussion_r357332852
##########
File path:
gateway-discovery-cm/src/test/java/org/apache/knox/gateway/topology/discovery/cm/auth/AuthUtilsTest.java
##########
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
under
+ * the License.
+ */
+package org.apache.knox.gateway.topology.discovery.cm.auth;
+
+import org.apache.knox.gateway.config.GatewayConfig;
+import org.junit.Test;
+
+import javax.security.auth.login.Configuration;
+import java.io.File;
+import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.fail;
+
+public class AuthUtilsTest {
+
+ /**
+ * Since the login config should only be loaded once, the Configuration
object should be the same for repeated
+ * requests thereof.
+ *
+ * KNOX-1962
+ */
+ @Test
+ public void testLoadJAASConfigOnce() {
+ File loginConfigFile = createTestKrb5LoginConfigFile();
+ Configuration conf1 = null;
+ Configuration conf2 = null;
+ try {
+ System.setProperty(GatewayConfig.KRB5_LOGIN_CONFIG,
loginConfigFile.getAbsolutePath());
+ conf1 = AuthUtils.getKerberosJAASConfiguration();
+ conf2 = AuthUtils.getKerberosJAASConfiguration();
+ } catch (Throwable e) {
+ e.printStackTrace();
+ fail(e.getMessage());
Review comment:
should be able to just `fail(e)` which prints the stacktrace
----------------------------------------------------------------
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:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 358892)
Time Spent: 20m (was: 10m)
> CM discovery - Avoid reading krb5 login config multiple times
> -------------------------------------------------------------
>
> Key: KNOX-1962
> URL: https://issues.apache.org/jira/browse/KNOX-1962
> Project: Apache Knox
> Issue Type: Sub-task
> Components: cm-discovery
> Affects Versions: 1.3.0
> Reporter: Kevin Risden
> Assignee: Philip Zampino
> Priority: Minor
> Fix For: 1.4.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> It looks like
> gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/auth/AuthUtils.java
> reads the krb5 login config multiple times when it doesn't need to.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)