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

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

    [ https://issues.apache.org/jira/browse/SHIRO-415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13569702#comment-13569702 ] 

Les Hazlewood commented on SHIRO-415:
-------------------------------------

Great catch - thanks for the report!
                
> 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
>              Labels: i18n
>             Fix For: 1.2.2
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> 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