Uploaded image for project: 'Shiro'
  1. Shiro
  2. SHIRO-415

isLoginAttempt method in BasicHttpAuthenticationFilter class fails if used in any locale other than English

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.2.1
    • 1.2.2
    • Realms
    • Eclipse, netbeans, windows 7 Turkish

    Description

      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); }

      Attachments

        Activity

          People

            Unassigned Unassigned
            cenap Salih Cenap Baydar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 24h
                24h
                Remaining:
                Remaining Estimate - 24h
                24h
                Logged:
                Time Spent - Not Specified
                Not Specified