Package org.wildfly.security.http.oidc
Class JWTClientSecretCredentialsProvider
- java.lang.Object
-
- org.wildfly.security.http.oidc.JWTClientSecretCredentialsProvider
-
- All Implemented Interfaces:
ClientCredentialsProvider,ClientSecretCredentialsProvider
@MetaInfServices(ClientCredentialsProvider.class) public class JWTClientSecretCredentialsProvider extends Object implements ClientSecretCredentialsProvider
Client authentication based on JWT signed by a client secret instead of a private key.- Author:
- Marek Posolda, Farah Juma
-
-
Field Summary
Fields Modifier and Type Field Description private SecretKeyclientSecretprivate StringclientSecretJwtAlgprivate inttokenTimeout
-
Constructor Summary
Constructors Constructor Description JWTClientSecretCredentialsProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private org.jose4j.jwt.JwtClaimscreateRequestToken(String clientId, String tokenUrl)StringcreateSignedRequestToken(String clientId, String tokenUrl)StringcreateSignedRequestToken(String clientId, String tokenUrl, String algorithm)SecretKeygetClientSecret()StringgetId()Return the ID of the provider.protected intgetTokenTimeout()voidinit(OidcClientConfiguration oidcClientConfiguration, Object credentialsConfig)Called during deployment of your application.private booleanisValidClientSecretJwtAlg(String clientSecretJwtAlg)voidsetClientCredentials(OidcClientConfiguration oidcClientConfiguration, Map<String,String> requestHeaders, Map<String,String> formParams)Called every time a backchannel request is performed.voidsetClientSecret(String clientSecretString)voidsetClientSecret(String clientSecretString, String algorithm)voidsetTokenTimeout(int tokenTimeout)
-
-
-
Method Detail
-
getId
public String getId()
Description copied from interface:ClientCredentialsProviderReturn the ID of the provider. Use this ID in the oidc.json configuration as the sub-element of the "credentials" element For example if your provider has ID "some-provider", use the configuration like this in oidc.json "credentials": { "some-provider": { "someAttribute": "someValue" } }- Specified by:
getIdin interfaceClientCredentialsProvider- Returns:
- the ID of the provider
-
setTokenTimeout
public void setTokenTimeout(int tokenTimeout)
-
getTokenTimeout
protected int getTokenTimeout()
-
init
public void init(OidcClientConfiguration oidcClientConfiguration, Object credentialsConfig)
Description copied from interface:ClientCredentialsProviderCalled during deployment of your application.- Specified by:
initin interfaceClientCredentialsProvider- Parameters:
oidcClientConfiguration- the OIDC client configurationcredentialsConfig- the configuration of your credentials provider read from oidc.json. For the some-provider example above, it will return map with the single key "someAttribute" with value "someValue"
-
isValidClientSecretJwtAlg
private boolean isValidClientSecretJwtAlg(String clientSecretJwtAlg)
-
setClientCredentials
public void setClientCredentials(OidcClientConfiguration oidcClientConfiguration, Map<String,String> requestHeaders, Map<String,String> formParams)
Description copied from interface:ClientCredentialsProviderCalled every time a backchannel request is performed.- Specified by:
setClientCredentialsin interfaceClientCredentialsProvider- Parameters:
oidcClientConfiguration- the fully resolved OIDC client configurationrequestHeaders- 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 the OpenID providerformParams- 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 the OpenID provider
-
getClientSecret
public SecretKey getClientSecret()
- Specified by:
getClientSecretin interfaceClientSecretCredentialsProvider
-
setClientSecret
public void setClientSecret(String clientSecretString)
-
createSignedRequestToken
public String createSignedRequestToken(String clientId, String tokenUrl, String algorithm)
-
-