You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shiro.apache.org by "Brian Demers (JIRA)" <ji...@apache.org> on 2016/07/15 15:07:20 UTC

[jira] [Closed] (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:all-tabpanel ]

Brian Demers closed SHIRO-415.
------------------------------

> 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 was sent by Atlassian JIRA
(v6.3.4#6332)