Class JWTClientCredentialsProvider
- java.lang.Object
- 
- org.keycloak.protocol.oidc.client.authentication.JWTClientCredentialsProvider
 
- 
- All Implemented Interfaces:
- ClientCredentialsProvider
 
 public class JWTClientCredentialsProvider extends Object implements ClientCredentialsProvider Client authentication based on JWT signed by client private key . See specs for more details.- Author:
- Marek Posolda
 
- 
- 
Field SummaryFields Modifier and Type Field Description static StringPROVIDER_ID
 - 
Constructor SummaryConstructors Constructor Description JWTClientCredentialsProvider()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected JsonWebTokencreateRequestToken(String clientId, String realmInfoUrl)StringcreateSignedRequestToken(String clientId, String realmInfoUrl)StringgetId()Return the ID of the provider.PublicKeygetPublicKey()protected intgetTokenTimeout()voidinit(AdapterConfig deployment, Object config)Called by adapter during deployment of your application.voidsetClientCredentials(AdapterConfig deployment, Map<String,String> requestHeaders, Map<String,String> formParams)Called every time adapter needs to perform backchannel requestvoidsetTokenTimeout(int tokenTimeout)voidsetupKeyPair(KeyPair keyPair)voidsetupKeyPair(KeyPair keyPair, String algorithm)
 
- 
- 
- 
Field Detail- 
PROVIDER_IDpublic static final String PROVIDER_ID - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
getIdpublic String getId() Description copied from interface:ClientCredentialsProviderReturn the ID of the provider. Use this ID in the keycloak.json configuration as the subelement of the "credentials" element For example if your provider has ID "kerberos-keytab" , use the configuration like this in keycloak.json "credentials": { "kerberos-keytab": { "keytab": "/tmp/foo" } }- Specified by:
- getIdin interface- ClientCredentialsProvider
- Returns:
 
 - 
setupKeyPairpublic void setupKeyPair(KeyPair keyPair) 
 - 
setTokenTimeoutpublic void setTokenTimeout(int tokenTimeout) 
 - 
getTokenTimeoutprotected int getTokenTimeout() 
 - 
getPublicKeypublic PublicKey getPublicKey() 
 - 
initpublic void init(AdapterConfig deployment, Object config) Description copied from interface:ClientCredentialsProviderCalled by adapter during deployment of your application. You can for example read configuration and init your authenticator here- Specified by:
- initin interface- ClientCredentialsProvider
- Parameters:
- deployment- the adapter configuration
- config- the configuration of your provider read from keycloak.json . For the kerberos-keytab example above, it will return map with the single key "keytab" with value "/tmp/foo"
 
 - 
setClientCredentialspublic void setClientCredentials(AdapterConfig deployment, Map<String,String> requestHeaders, Map<String,String> formParams) Description copied from interface:ClientCredentialsProviderCalled every time adapter needs to perform backchannel request- Specified by:
- setClientCredentialsin interface- ClientCredentialsProvider
- Parameters:
- deployment- Fully resolved deployment
- requestHeaders- You should put any HTTP request headers you want to use for authentication of client. These headers will be attached to the HTTP request sent to Keycloak server
- formParams- You should put any request parameters you want to use for authentication of client. These parameters will be attached to the HTTP request sent to Keycloak server
 
 - 
createSignedRequestTokenpublic String createSignedRequestToken(String clientId, String realmInfoUrl) 
 - 
createRequestTokenprotected JsonWebToken createRequestToken(String clientId, String realmInfoUrl) 
 
- 
 
-