In this example, I am creating a client credential flow based client. The difference is unlike the traditional client secret, here I am using JWT signed by the client private key. In the authorization server when a request comes from the client, the authorization server will verify the signature of the JWT using client's public key.
There are two ways we can make available the client's public key to the authorization server
- We can upload the client certificate to the authorization server
- Or we can provide a Json Web Key Set (JWKS) url to the authorization server, where the client's public key will be available in the form of JSON Web Key Set.
In this example, I am using the latter one.
Note :
- For the code to work following things are needed
- A key store in the form of
JKSin theresourcesdirectory with the namekeystore.jks - A
credentials.yamlfile in theresourcesdirectory in the format ofcredentials.yaml.example - Change the values inside the
application.yamlaccording to your configuration
- A key store in the form of
- I used
keycloakserver for this project.