This is not my code. It is seam code.
see below the encoding section:
protected String encodeToken(String username, String value)
   {
      StringBuilder sb = new StringBuilder();
      sb.append(username);
      sb.append(":");
      sb.append(value);
      return Base64.encodeBytes(sb.toString().getBytes());
   }



On Sat, Dec 5, 2009 at 2:14 PM, André Warnier <a...@ice-sa.com> wrote:

> itay sahar wrote:
>
>> Hi all,
>>
>> I'm using seam on tomcat 6.0.20 and encounter problem in my security
>> module.
>>
>> Basically, i try to add cookie with base64 encoding of the username which
>> is
>> email address.
>>
>
>  The encoding works and no exception is thrown. But when seam try adding
>> the
>> cookie an exception is thrown:
>>
>> 05/12/2009 02:23:00 com.sun.faces.lifecycle.Phase doPhase
>> SEVERE: JSF1054: (Phase ID: INVOKE_APPLICATION 5, View ID: /login.xhtml)
>> Exception thrown during phase execution:
>>
>> javax.faces.event.phaseevent[source=com.sun.faces.lifecycle.lifecyclei...@7d5
>> 05/12/2009 02:23:00 org.ajax4jsf.webapp.BaseXMLFilter doXmlFilter
>> SEVERE: Exception in the filter chain
>> javax.servlet.ServletException: #{identity.login}:
>> java.lang.IllegalArgumentException: Control character in cookie value,
>> consider BASE64 encoding your value
>>        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
>>
>
> Obviously, the value of your cookie is /not/ Base-64 encoded.
> I also cannot see in your code where that encoding should take place.
>
> And if the value is really an email address, and if you really do encode it
> somewhere else than in the code you show, then what probably happens is that
> your Base-64 encoded string exceeds 80 characters, and is being wrapped with
> a CR/LF somewhere.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

Reply via email to