[keycloak-user] App secured in Apache TomEE not works

tecnologia at growingup.com.co tecnologia at growingup.com.co
Fri Nov 18 10:35:29 EST 2016


Hello Sebastien,

 

You saved my life!!!

 

I manually modified the keycloak-tomcat8-adapter-2.3.0.Final file and it worked perfectly.

 

public class KeycloakAuthenticatorValve

  extends AbstractKeycloakAuthenticatorValve

{

  public boolean authenticate(Request request, HttpServletResponse response)

    throws IOException

  {

    return authenticateInternal(request, response, request.getContext().getLoginConfig());

  }

  

  protected boolean doAuthenticate(Request request, HttpServletResponse response)

    throws IOException

  {

    return authenticate(request, response);

  }

  

  protected boolean forwardToErrorPageInternal(Request request, HttpServletResponse response, Object loginConfig)

    throws IOException

  …..

 

 

This will fix the problem while the new version arrives.

 

Server: Apache Tomcat (TomEE)/8.5.6 (7.0.2)

 

Thank you very much.

 

 

De: Sebastien Blanc [mailto:sblanc at redhat.com] 
Enviado el: viernes, 18 de noviembre de 2016 9:18
Para: tecnologia at growingup.com.co
CC: keycloak-user
Asunto: Re: [keycloak-user] App secured in Apache TomEE not works

 

Is your TomEE version using Tomcat 8.5.5 ? Because it looks like a really similar issue https://issues.jboss.org/browse/KEYCLOAK-3669?filter=-2 and this is fixed andshould be available in the next release

 

On Fri, Nov 18, 2016 at 2:42 PM, <tecnologia at growingup.com.co> wrote:

Hello community:


I have secured my application on an Apache 8 server, following the steps,
but when accessing a protected resource I hope to be redirected to Keycloak
but nothing happens.

I'm getting this error (HTTP CODE 500)

Nov 18, 2016 1:02:19 AM org.apache.catalina.authenticator.FormAuthenticator
forwardToLoginPage
WARNING: No login page was defined for FORM authentication in context [/
sis]

I added the keycloak.json file in the WEB-INF and the context.xml file in
the META-INF. I have also done my security settings on the web.xml.



keycloak.json:



{

  "realm": "expocafe",

  "auth-server-url": "http://localhost:8080/auth",

  "ssl-required": "external",

  "resource": "sis",

  "credentials": {

    "secret": "8ccc6994-2e05-48d3-9aea-f6f31beb2819"

  }

}



context.xml:



<?xml version='1.0' encoding='utf-8'?>

<Context path="/sis">

       <Valve
className="org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve" />

</Context>



web.xml:



<security-constraint>

             <web-resource-collection>

                    <web-resource-name>Secured pages</web-resource-name>

                    <url-pattern>/pages/*</url-pattern>

             </web-resource-collection>

             <auth-constraint>

                    <role-name>expocafe_usuario</role-name>

             </auth-constraint>

       </security-constraint>



       <login-config>

             <auth-method>BASIC</auth-method>

             <realm-name>expocafe</realm-name>

       </login-config>



       <!-- Rol definido en Keycloak para permitir el acceso basico a la
aplicacion -->

       <security-role>

             <role-name>expocafe_usuario</role-name>

       </security-role>



What could I check?



Keycloak v2.3.0.Final

Apache Tomcat 8.5



_______________________________________________
keycloak-user mailing list
keycloak-user at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-user

 



More information about the keycloak-user mailing list