Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keycloak Unknown authentication mechanism

I need help with using keycloak in an Errai app. I am getting an error about "unknown authentication method" for "KEYCLOAK" ? I have the keycloak-appliance running (on a different port though), and the Errai app has a with KEYCLOAK in the web.xml file inside WEB-INF When I run the Errai app with mvn gwt:run, I get : RuntimeException caused by "Unknown authentication mechanism KEYCLOAK". I have no idea how to go around this issue .

like image 520
Odili Charles Opute Avatar asked Dec 02 '14 15:12

Odili Charles Opute


People also ask

How secure is Keycloak?

Advantages of Using Keycloak They are safe in the hands of Security Experts like Keycloak. It is easier and safer to protect a single server dedicated to Identity Management and Security than every server that runs various service providers.

What is Wildfly in Keycloak?

We will use the Wildfly CLI to install the Keycloak OIDC client adapter. The Wildfly CLI is a Command Line Interface management tool for a standalone server or a managed domain. It allows us to connect to a standalone Wildfly server or domain controller and execute management operations.

How do I get a json Keycloak?

From the official documentation page of Keycloak it is suggested to download the keycloak. json from "Installation"-Tab after you create a keycloak client and save that where your HTML-Page is located so you can use that to initialize the JavaScript Keycloak adapter.


2 Answers

Just wanted to add a little more detail to @cfsnyder's answer. In order for your application server to recognize a definition in the web.xml that looks like this:

<login-config>
    <auth-method>KEYCLOAK</auth-method>
    <realm-name>internal</realm-name>
</login-config>

you'll need to tell jboss (in this instance) how to interpret that particular auth method. At the time of my answer, this is in section 8.2 of the Keycloak docs.

First, download the keycloak adapter (remember, this is not the same as the Keycloak Server). Next, unzip the download in the wildfly home directory. With your application server running, just use the following command to install the Keycloak configuration into the appropriate files:

jboss-cli.sh -c --file=adapter-install.cli

When this script completes, your configuration file will have the new entry added to accommodate the KEYCLOAK entry in your web.xml. The script will add something like this to either a domain.xml or standalone.xml:

            <security-domain name="keycloak">
                <authentication>
                    <login-module code="org.keycloak.adapters.jboss.KeycloakLoginModule" flag="required"/>
                </authentication>
            </security-domain>

Once you have the Keycloak module files provided by the adapter + the security domain configuration to link the KEYCLOAK method to the appropriate LoginModule, you should be all set.

like image 92
josh-cain Avatar answered Oct 19 '22 10:10

josh-cain


You will need to install and configure the Wildfly adapter in order for your Errai app to recognize the "KEYCLOAK" authentication method. See section 7.2 of the Keycloak documentation.

like image 27
cfsnyder Avatar answered Oct 19 '22 12:10

cfsnyder