Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-5625

Unable to impersonate user with surrogate pair character

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Auth Core 1.3.12
    • Auth Core 1.3.16
    • Authentication
    • None

    Description

      When trying to impersonate to a user having surrogate pair character (e.g. "中文test"), SlingAuthenticator throws an error:

      23.03.2016 10:34:37.637 *ERROR* [qtp1315207446-3359] org.apache.felix.http.jetty Exception while processing request to /home/users/I/ (java.lang.IllegalArgumentException: Illegal character in cookie value)
      java.lang.IllegalArgumentException: Illegal character in cookie value
      	at org.eclipse.jetty.server.Response.isQuoteNeededForCookie(Response.java:405)
      	at org.eclipse.jetty.server.Response.addSetCookie(Response.java:353)
      	at org.eclipse.jetty.server.Response.addCookie(Response.java:239)
      	at javax.servlet.http.HttpServletResponseWrapper.addCookie(HttpServletResponseWrapper.java:56)
      	at org.apache.sling.auth.core.impl.SlingAuthenticator.sendSudoCookie(SlingAuthenticator.java:1225)
      	at org.apache.sling.auth.core.impl.SlingAuthenticator.setSudoCookie(SlingAuthenticator.java:1344)
      	at org.apache.sling.auth.core.impl.SlingAuthenticator.getResolver(SlingAuthenticator.java:777)
      	at org.apache.sling.auth.core.impl.SlingAuthenticator.doHandleSecurity(SlingAuthenticator.java:495)
      	at org.apache.sling.auth.core.impl.SlingAuthenticator.handleSecurity(SlingAuthenticator.java:449)
      	at org.apache.sling.engine.impl.SlingHttpContext.handleSecurity(SlingHttpContext.java:121)
      	at org.apache.felix.http.base.internal.service.ServletContextImpl.handleSecurity(ServletContextImpl.java:421)
      	at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:57)
      	at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:124)
      	at org.apache.felix.http.base.internal.DispatcherServlet.service(DispatcherServlet.java:61)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
      

      This is due to the implementation of SlingAuthenticator#quoteCookieValue() that cannot handle surrogate pair character.

      Attachments

        Issue Links

          Activity

            People

              asanso Antonio Sanso
              christanto Christanto
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: