You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shiro.apache.org by "Salih Cenap Baydar (JIRA)" <ji...@apache.org> on 2013/02/02 14:32:12 UTC

[jira] [Created] (SHIRO-415) isLoginAttempt method in BasicHttpAuthenticationFilter class fails if used in any locale other than English

Salih Cenap Baydar created SHIRO-415:
----------------------------------------

             Summary: isLoginAttempt method in BasicHttpAuthenticationFilter class fails if used in any locale other than English
                 Key: SHIRO-415
                 URL: https://issues.apache.org/jira/browse/SHIRO-415
             Project: Shiro
          Issue Type: Bug
          Components: Realms 
    Affects Versions: 1.2.1
         Environment: Eclipse, netbeans, windows 7 Turkish
            Reporter: Salih Cenap Baydar
            Priority: Minor
             Fix For: 1.2.2


In isLoginAttempt method in BasicHttpAuthenticationFilter class fails if used in any locale other than English. This happens because at the line String authzScheme = getAuthzScheme().toLowerCase(); , the toLowerCase methods takes i18n into consideration. If the locale of the host is Turkish the string "BASIC" becomes "basıc" but not "basic" (there is the letter "ı" -lowercase i without the dot-  in Turkish) So the comparison returns false. The method fails.

The solution is pretty easy:

The two lines of the method "isLoginAttempt" in BasicHttpAuthenticationFilter class should be changed as below to make sure it works always the same:

    protected boolean isLoginAttempt(String authzHeader) {
        String authzScheme = getAuthzScheme().toLowerCase(Locale.ENGLISH);
        return authzHeader.toLowerCase(Locale.ENGLISH).startsWith(authzScheme);
    }  

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira