You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "Kevin Risden (JIRA)" <ji...@apache.org> on 2019/07/31 17:48:00 UTC

[jira] [Updated] (KNOX-1959) HadoopAuthCookieStore should not read krb5config each time

     [ https://issues.apache.org/jira/browse/KNOX-1959?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kevin Risden updated KNOX-1959:
-------------------------------
    Description: 
Currently HadoopAuthCookieStore checks the configured principal over and over again from krb5conf file on each cookie. This is unnecessary and can be improved.

Specifically the following section doesn't need to read the krb5config 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}


  was:Currently HadoopAuthCookieStore checks the configured principal over and over again from krb5conf file on each cookie. This is unnecessary and can be improved.


> HadoopAuthCookieStore should not read krb5config 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
>
>
> Currently HadoopAuthCookieStore checks the configured principal over and over again from krb5conf file on each cookie. This is unnecessary and can be improved.
> Specifically the following section doesn't need to read the krb5config 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)