keycloak-scim/examples/basic-auth
Stian Thorgersen f6631a6163 KEYCLOAK-1187
2015-04-14 09:28:05 +02:00
..
src/main KEYCLOAK-861 Support basic authentication against user credentials managed by KeyCloak. 2014-12-01 11:43:19 +00:00
basicauthrealm.json KEYCLOAK-1187 2015-04-14 09:28:05 +02:00
pom.xml bump pom versio 2015-04-02 09:36:43 -04:00
README.md KEYCLOAK-861 Support basic authentication against user credentials managed by KeyCloak. 2014-12-01 11:43:19 +00:00

Keycloak Example - Basic Authentication

The following example was tested on Wildfly 8.1.0.Final and JBoss EAP 6.3. It should be compatible with any JBoss AS, JBoss EAP or Wildfly that supports Java EE 7.

This example demonstrates basic authentication support for a Keycloak protected REST service. However, more importantly it enables a REST service to be secured using both basic and bearer token authentication, which is useful where the service needs to be accessed both as part of a single signon session, and also as a standalone REST service.

Step 1: Setup a basic Keycloak server

Install Keycloak server and start it on port 8080. Check the Reference Guide if unsure on how to do it.

Once the Keycloak server is up and running, import the realm basicauthrealm.json.

Step 2: Deploy and run the example

This should result in the value 'hello' being returned as a response.

Simply change the username (currently 'admin') or password (currently 'password') in the command to see an "Unauthorized" response.