...
will produce the same result as above.
You can also upload your private key and certificate to the realm you are using.
Go to Relam Settings → Keys - > Providers → Add Keystore → RSA
Upload both you private key and it's correspoding certificate.
Go to Relam Settings → General and click on "OpenID Endpoint configuration"
Search for jwks_url and you should see somthing like the following :
"jwks_uri":"http://127.0.0.1:33409/auth/realms/x509/protocol/openid-connect/certs"
Go to this URL, your jwks should be on the bottom.
For this to work with you JWT code you'll need to copy the "kid" value and update you code so this is included in the header:
Code Block | ||||
---|---|---|---|---|
| ||||
claims["iss"] = "jwtclient3"
claims["aud"] = "https://192.168.49.2:31561/auth/realms/x509"
token := jwt.NewWithClaims(jwt.SigningMethodRS256, claims)
token.Header["kid"] = "AKAwbsKtqu9OmIwIsPOUf5zTJkIC73hzY9Myv4srjTs"
tokenString, err := token.SignedString(key)
if err != nil {
return "", fmt.Errorf("create: sign token: %w", err)
}
return tokenString, nil
} |
Keycloak Rest API
Documentation for the keycloak Rest API is available here: Keycloak Admin REST API
...