Github user ctubbsii commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/273#discussion_r124147278
  
    --- Diff: 
core/src/main/java/org/apache/accumulo/core/client/security/tokens/KerberosToken.java
 ---
    @@ -51,11 +52,11 @@
        *          The user that is logged in
        */
       public KerberosToken(String principal) throws IOException {
    -    requireNonNull(principal);
    +    this.principal = requireNonNull(principal);
         final UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
    -    checkArgument(ugi.hasKerberosCredentials(), "Subject is not logged in 
via Kerberos");
    -    checkArgument(principal.equals(ugi.getUserName()), "Provided principal 
does not match currently logged-in user");
    -    this.principal = ugi.getUserName();
    +    if (AuthenticationMethod.KERBEROS == ugi.getAuthenticationMethod()) {
    +      checkArgument(ugi.hasKerberosCredentials(), "Subject is not logged 
in via Kerberos");
    +    }
    --- End diff --
    
    FWIW, the current code would always fail without Kerberos credentials, so 
it was already somewhat comprehensive, covering the other cases (SIMPLE, TOKEN, 
etc.), so I wouldn't go so far as to say your previous logic was sub-par (the 
issue in this PR aside). But, after this change, the extra check would be nice 
to restore the previous restrictions to the Kerberos and now Proxy case.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to