Hello All,

 

I am new to Key Cloak and trying to integrate this with a very basic two-page application to understand the working and integration basics.

 

Environment:

 

1.       KeyCloack 1.7.1 Final Standalone

2.       A Basic Spring Application deployed on Tomcat 7  

 

What I have referred:

http://docs.jboss.org/keycloak/docs/1.2.0.Beta1/userguide/html_single/index.html#tomcat-adapter

Tutorial Videos from Youtube Basic 1 and 2

 

Issues am facing:

 

When I set auth-method to KEYCLOAK

<login-config>

       <auth-method>KEYCLOAK</auth-method>

       <realm-name>KnowledgeFlux</realm-name>

</login-config>

 

I get the following error

 

Jan 06, 2016 2:12:58 PM org.apache.catalina.startup.ContextConfig authenticatorConfig

SEVERE: Cannot configure an authenticator for method KEYCLOAK

Jan 06, 2016 2:12:58 PM org.apache.catalina.startup.ContextConfig configureStart

SEVERE: Marking this application unavailable due to previous error(s)

 

When I set auth-method to BASIC

<login-config>

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

       <realm-name>KnowledgeFlux</realm-name>

</login-config>

 

Application runs fine but doesn’t authenticate even though the user is able to login to Keycloak Realm’s account.

 

What my files look like

 

Web.xml

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

       xmlns="http://java.sun.com/xml/ns/javaee"

       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"

       id="WebApp_ID" version="3.0">

       <display-name>Archetype Created Web Application</display-name>

       <servlet>

              <servlet-name>dispatcher</servlet-name>

              <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

              <load-on-startup>1</load-on-startup>

       </servlet>

 

       <servlet-mapping>

              <servlet-name>dispatcher</servlet-name>

              <url-pattern>/</url-pattern>

       </servlet-mapping>

 

       <context-param>

              <param-name>contextConfigLocation</param-name>

              <param-value>/WEB-INF/dispatcher-servlet.xml</param-value>

       </context-param>

 

       <listener>

              <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

       </listener>

 

       <security-constraint>

              <web-resource-collection>

                     <web-resource-name>CloakTest</web-resource-name>

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

              </web-resource-collection>

              <auth-constraint>

                     <role-name>User</role-name>

              </auth-constraint>

       </security-constraint>

 

       <login-config>

              <auth-method>KEYCLOAK</auth-method>

              <realm-name>KnowledgeFlux</realm-name>

       </login-config>

 

       <security-role>

              <role-name>admin</role-name>

       </security-role>

       <security-role>

              <role-name>User</role-name>

       </security-role>

 

</web-app>

 

Keycloak.json

 

{

  "realm": "KnowledgeFlux",

  "realm-public-key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAggGsu2SLSsgi7WmVb4O2HGQX7CjcZQG3+LK0Ael6ErNf3dsv4eAR7dTw7OP3hSl57ByCuX5srFFnOMQR+WrjGFv6osaabzRAqYgfKF9H0dIuBLDfFcohGG1EIWh6jVn+jifflnEw7kbycKlXypuvrev7FXi0v1/8Iy/VPdRk+iVgSSIwU/InNPOrodVF/CV6p9VcPqGbDcOSdC0gu6kUA8S4Y6zVRtszlBD3g07p8QhkjoUeKHgHAT0CeCpLoe57ud9iTPTpX0iBnDCysJOQYK3FGAiz6Z9C/puolcrUIcuiasM6Z9bgglNTFvZCbk/XSDGTFKqkJGdcraeVdbQx3wIDAQAB",

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

  "ssl-required": "external",

  "resource": "CloakTest",

  "public-client": true

}

 

META-INF/context.xml

 

<?xml version="1.0"?>

<Context path="/CloakTest">

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

</Context>

 

 

Note:  Application’s name is CloakTest and am using the same name for the client and my realm’s name is KnowledgeFlux

 

I have googled for similar issues with no luck and it’s been a while since I am stuck here.

Please assist.

 

P.S. Sorry for the essay but I added as much detail as I thought would be necessary.

 

Thanks,
Pawan