Here you find some demos on how to use the experimental feature of Keycloak for Verifiable Credentials (Issuer and Verifier)
- Docker engine and docker compose
- Developer toolkit for OpenID4VC
- Keycloak OID4VP verifier extension
1.Install Developer toolkit cli client for OpenID4VC via release download 2.Clone Developer toolkit for OpenID4VC repository for executing the demos
This demo starts a Keycloak instance as Verifiable Credential Issuer and imports the required realm configuration and then interacts with Keycloak to issue a Verifiable Credential to a locally running wallet instance.
Run these steps to start the demo:
- Open a terminal and navigate to the
oid4vc-dev/examples/keycloak-issuer-walletdirectory - Run
./start.sh --setup-only. This starts Keycloak and imports the realm configuration - Open your browser and navigate to
http://localhost:8080/to open the Keycloak admin console (login with admin/admin) - Switch to the
oidc4vc-demorealm - Check the realm settings and make sure the
Verifiable Credentialsfeature is enabled - On the
tokentab of the real settings make sure that thePre-Authorized Code Lifespanis set to at least 2 minutes. - Verify the client scope
membership-credential(used by theoid4vc-demo-client) is created and includes theOID4VC Mappermappers - Now run script
./scripts/create-offer.shto get the credential offer from the Keycloak server including pre-authorized code - Copy the output beginning from
openid-credential-offer://up to the end - Run
oid4vc-dev wallet accept [offer](replace "[offer]" with your copied offer from previous step) to issue the credential to the wallet - Run
oid4vc-dev wallet listto see the issued credentials. - Run
oid4vc-dev wallet logsto all interactions between the wallet and Keycloak - Run
oid4vc-dev wallet serve --port 4300to start the wallet UI. Navigate your brosers tohttp://localhost:4300/to see the issued credential.
You may also want to look inside the credential JWT to see the claims with their ID's.
For this run oid4vc-dev wallet list to see the issued credentials. Then run oid4vc-dev wallet show [id] to show the credential details
Now run oid4vc-dev serve --port 4200 to show a locally running decoder for the credential.
Navigate your browser to http://localhost:4200/ and paste your credential to see the decoded credential.
After finishing the demo make sure you run docker compose down in the oid4vc-dev/examples/keycloak-issuer-wallet folder to stop the Keycloak instance.
Also clean up the wallet instance by running
oid4vc-dev wallet remove --all to remove all credentials and oid4vc-dev wallet logs clean to clear all wallet logs.
This demo starts a Keycloak instance as Verifiable Credential Verifier (by installing the corresponding extension) and imports the required realm configuration and then interacts with Keycloak to verify a Verifiable Credential presented by a locally running wallet instance.
- Open a terminal and navigate to the
oid4vc-dev/examples/keycloak-verifier-oid4vptdirectory - Run
./start.sh. This runs the complete demo by importing test credentials into the wallet and presenting a credential to Keyckloak as a verifier. - Run
oid4vc-dev wallet logsto all interactions between the wallet and Keycloak - Run
oid4vc-dev wallet serve --port 4300to start the wallet UI. Navigate your brosers tohttp://localhost:4300/to see the issued credential.