GitXplorerGitXplorer
h

keycloak-openshift-auth-example

public
0 stars
4 forks
0 issues

Commits

List of commits on branch master.
Unverified
4485dca39084e16d747195f2732f631cf7073ace

Updates demo app description

bbartoszmajsak committed 8 years ago
Unverified
1fef8c967893e151766139f53543d1340f1ee8f5

Documents test env setup

bbartoszmajsak committed 8 years ago
Unverified
e0e6cef9b2c8b10beb84b843edfe7c8e9cb6dede

Fixes ignore for rsync deployment folder

bbartoszmajsak committed 8 years ago
Unverified
627c4ebc93880e1719086641f5038068b86b0a02

Ignores .deployments folder

bbartoszmajsak committed 8 years ago
Unverified
ff554cd6d27738fdb8233d74e1993faa9a23dafd

Openshift deploy scripts

bbartoszmajsak committed 8 years ago
Unverified
dc63a2276061765f1942f034f2adaa204f128bcb

Documents usage of the proxy

bbartoszmajsak committed 8 years ago

README

The README file for this repository.

Set up local enviroment

minishift start
oc new-project keycloak --display-name="Keycloak server" --description="keycloak server + postgres"

Deploy keycloak and postgres

pushd ${PWD}/openshift-deploy
./deploy.sh
popd

Open KeyCloak (e.g. google-chrome --incognito http://keycloak-keycloak.$(minishift ip).xip.io/auth/admin) and import realm openshift-v3-identity-provider-realm.json.

Create client

$ oc login -u system:admin
$ oc create -f <(echo "   
{
    \"kind\": \"OAuthClient\",
    \"apiVersion\": \"v1\",
    \"metadata\": {
    \"name\": \"openshift-v3-authentication\"
    },
    \"secret\": \"1234\",
    \"grantMethod\": \"prompt\",
    \"redirectURIs\": [
        \"http://keycloak-keycloak.$(minishift ip).xip.io/auth/realms/openshift-v3-identity-provider-realm/broker/openshift-v3/endpoint\"
    ]
}")
$ oc login -u developer

Configure Openshift Provider in KeyCloak:

  • Provide URL to minishift instance (e.g. use $ echo "https://$(minishift ip):8443" | xclip -sel c to copy to Base URL field)
  • (for dev only) Disable SSL certificates validation

Build project and deploy

mvn clean package && mkdir -p deployments && cp target/openshift-v3-authentication.war deployments/openshift-v3-authentication.war \
 && oc rsync ./deployments $(oc get pods | grep keycloak | cut -d' ' -f1):/opt/jboss/keycloak/standalone/

Test

First we need small proxy to ignore self-signed certificates from minishift. Simply start this docker container:

$ docker run -d --net=host -p 9009:9009 bartoszmajsak/minishift-ignore-cert-proxy \
  --targetHost=$(minishift ip) --targetPort=8443

Open demo application:

google-chrome --incognito http://keycloak-keycloak.$(minishift ip).xip.io/openshift-v3-authentication

Click on "Openshift V3" and authorize demo app. Then register your user. After landing on the dummy page you are able to load Openshift profile by clicking a "load" button.