Integrating with Golang applications
Go applications can integrate with Keycloak using whatever library you prefer, as long as it complies with the OpenID Connect or OAuth2 specifications.
For the sake of simplicity and to provide a generic example of how to integrate with Keycloak, we are going to use the https://github.com/coreos/go-oidc package. The code examples for this section are available in the following directory:
$ cd Keycloak-Identity-and-Access-Management-for-Modern-Applications/ch7/golang
In the preceding directory, you will find a main.go
file that contains all the code you will need to follow and run the examples.
In the next section, we are going to start looking at how to enable a web application that can authenticate users using Keycloak.
Configuring a Golang client
First, you need to create a provider using a base URL that the OpenID Connect Discovery Document will be fetched from. This will set up the necessary endpoints that your application...