[
https://issues.apache.org/jira/browse/KNOX-1959?focusedWorklogId=286112&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-286112
]
ASF GitHub Bot logged work on KNOX-1959:
----------------------------------------
Author: ASF GitHub Bot
Created on: 31/Jul/19 18:14
Start Date: 31/Jul/19 18:14
Worklog Time Spent: 10m
Work Description: risdenk commented on pull request #124: KNOX-1959 -
HadoopAuthCookieStore should not read krb5 login config each time
URL: https://github.com/apache/knox/pull/124
## What changes were proposed in this pull request?
Move knox principal to constructor and use that each time to check cookie
## How was this patch tested?
`mvn -T.5C clean verify -Ppackage,release -Dshellcheck`
----------------------------------------------------------------
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: 286112)
Time Spent: 10m
Remaining Estimate: 0h
> HadoopAuthCookieStore should not read krb5 login config each time
> -----------------------------------------------------------------
>
> Key: KNOX-1959
> URL: https://issues.apache.org/jira/browse/KNOX-1959
> Project: Apache Knox
> Issue Type: Improvement
> Reporter: Kevin Risden
> Assignee: Kevin Risden
> Priority: Major
> Fix For: 1.4.0
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Currently HadoopAuthCookieStore isKnoxCookie checks the configured principal
> over and over again from krb5 login config file on each cookie. This is
> unnecessary and can be improved.
> Specifically the following section doesn't need to read the krb5 login config
> each time. We can do this once in the constructor. We should not expect krb5
> config to change from underneath us.
> {code:java}
> if (principal != null) {
> String krb5Config = config.getKerberosLoginConfig();
> if (krb5Config != null && !krb5Config.isEmpty()) {
> Properties p = new Properties();
> try (InputStream in =
> Files.newInputStream(Paths.get(krb5Config))){
> p.load(in);
> String configuredPrincipal = p.getProperty("principal");
> // Strip off enclosing quotes, if present
> if (configuredPrincipal.startsWith("\"")) {
> configuredPrincipal = configuredPrincipal.substring(1,
> configuredPrincipal.length() - 1);
> }
> // Check if they're the same principal
> result = principal.equals(configuredPrincipal);
> } catch (IOException e) {
> LOG.errorReadingKerberosLoginConfig(krb5Config, e);
> }
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)