public class SimpleOIDCClient
extends java.lang.Object
Constructor and Description |
---|
SimpleOIDCClient() |
Modifier and Type | Method and Description |
---|---|
java.net.URI |
buildAuthorizationCodeRequest()
Authentication request
The authentication request is done by redirecting the end user to the provider, for more details see the OIDC specification.
|
void |
dumpTokenInfo()
Dump token info.
|
com.nimbusds.oauth2.sdk.token.AccessToken |
getAccessToken()
Gets the access token.
|
com.nimbusds.jwt.JWTClaimsSet |
getIdClaims()
Gets the id claims.
|
java.net.URI |
getRedirectURI()
Gets the redirect URI.
|
com.nimbusds.oauth2.sdk.id.State |
getState()
Gets the state.
|
net.minidev.json.JSONObject |
getUserInfoJSON()
Gets the user info JSON.
|
void |
lookupOpenIDProvider()
Issuer discovery
The WebFinger protocol is used to find the OpenID Provider (OP).
|
void |
parseAuthenticationDataFromRedirect(java.lang.String redirectionURL,
boolean overrideClient)
Parses the authentication data from redirect.
|
void |
processAuthenticationResponse(java.lang.String responseURL)
Receive the Authentication Response
The authentication response is sent from the provider by redirecting the end user to the redirect URI specified in the initial authentication request from the client.
|
void |
registerClient(com.nimbusds.oauth2.sdk.token.BearerAccessToken initialAccessToken)
Client registration
If the provider supports dynamic registration, a new client can be registered using the client registration process:.
|
void |
requestToken()
Token Request
When an authorization code (using code or hybrid flow) has been obtained, a token request can made to get the access token and the id token:.
|
void |
requestUserInfo()
UserInfo Request
Using the access token, information about the end user can be obtained by making a user info request.
|
void |
reset()
Reset.
|
void |
retrieveProviderMetadata()
Retrieve provider metadata.
|
void |
setAuthorizationEndpointURI(java.net.URI endpointURI)
Sets the authorization endpoint URI.
|
void |
setClientID(java.lang.String clientIDString,
java.lang.String clientSecret)
Sets the client ID.
|
void |
setClientMetadata(java.lang.String allowedClientRedirectURI)
Sets the client metadata.
|
void |
setClientRegistrationMetadata(java.lang.String allowedClientRedirectURI)
Sets the client registration metadata.
|
void |
setIssuerURI(java.lang.String issuerURIString)
Sets the issuer URI.
|
void |
setRedirectURI(java.lang.String redirectURIString)
Sets the redirect URI.
|
void |
setResourceOwnerCredentials(java.lang.String user,
java.lang.String password)
Sets the resource owner credentials.
|
void |
setTrustStore(java.io.File trustStoreFile)
Sets the trust store.
|
public void reset()
public void lookupOpenIDProvider()
public void setIssuerURI(java.lang.String issuerURIString) throws java.net.URISyntaxException
issuerURIString
- the new issuer URIjava.net.URISyntaxException
- the URI syntax exceptionpublic void setAuthorizationEndpointURI(java.net.URI endpointURI)
endpointURI
- the new authorization endpoint URIpublic void retrieveProviderMetadata() throws java.io.IOException, com.nimbusds.oauth2.sdk.ParseException, java.security.KeyManagementException, java.security.NoSuchAlgorithmException, java.security.cert.CertificateException, java.security.KeyStoreException
java.io.IOException
- Signals that an I/O exception has occurred.com.nimbusds.oauth2.sdk.ParseException
- the parse exceptionjava.security.KeyManagementException
- the key management exceptionjava.security.NoSuchAlgorithmException
- the no such algorithm exceptionjava.security.cert.CertificateException
- the certificate exceptionjava.security.KeyStoreException
- the key store exceptionpublic void setClientID(java.lang.String clientIDString, java.lang.String clientSecret)
clientIDString
- the client ID stringclientSecret
- the client secretpublic void setClientRegistrationMetadata(java.lang.String allowedClientRedirectURI) throws com.nimbusds.oauth2.sdk.ParseException
allowedClientRedirectURI
- the new client registration metadatacom.nimbusds.oauth2.sdk.ParseException
- the parse exceptionpublic void setClientMetadata(java.lang.String allowedClientRedirectURI) throws com.nimbusds.oauth2.sdk.ParseException
allowedClientRedirectURI
- the new client metadatacom.nimbusds.oauth2.sdk.ParseException
- the parse exceptionpublic void registerClient(com.nimbusds.oauth2.sdk.token.BearerAccessToken initialAccessToken) throws com.nimbusds.oauth2.sdk.SerializeException, java.io.IOException, com.nimbusds.oauth2.sdk.ParseException, java.security.KeyManagementException, java.security.NoSuchAlgorithmException, java.security.cert.CertificateException, java.security.KeyStoreException
initialAccessToken
- the initial access tokencom.nimbusds.oauth2.sdk.SerializeException
- the serialize exceptionjava.io.IOException
- Signals that an I/O exception has occurred.com.nimbusds.oauth2.sdk.ParseException
- the parse exceptionjava.security.KeyManagementException
- the key management exceptionjava.security.NoSuchAlgorithmException
- the no such algorithm exceptionjava.security.cert.CertificateException
- the certificate exceptionjava.security.KeyStoreException
- the key store exceptionpublic void setRedirectURI(java.lang.String redirectURIString) throws java.net.URISyntaxException
redirectURIString
- the new redirect URIjava.net.URISyntaxException
- the URI syntax exceptionpublic java.net.URI getRedirectURI()
public com.nimbusds.oauth2.sdk.id.State getState()
public void parseAuthenticationDataFromRedirect(java.lang.String redirectionURL, boolean overrideClient) throws com.nimbusds.oauth2.sdk.ParseException, java.net.URISyntaxException
redirectionURL
- the redirection URLoverrideClient
- the override clientcom.nimbusds.oauth2.sdk.ParseException
- the parse exceptionjava.net.URISyntaxException
- the URI syntax exceptionpublic java.net.URI buildAuthorizationCodeRequest() throws com.nimbusds.oauth2.sdk.SerializeException
com.nimbusds.oauth2.sdk.SerializeException
- the serialize exceptionpublic void processAuthenticationResponse(java.lang.String responseURL)
responseURL
- the response URLpublic void setResourceOwnerCredentials(java.lang.String user, java.lang.String password)
user
- the userpassword
- the passwordpublic void requestToken() throws java.security.KeyManagementException, java.security.NoSuchAlgorithmException, java.security.cert.CertificateException, java.security.KeyStoreException
java.security.KeyManagementException
- the key management exceptionjava.security.NoSuchAlgorithmException
- the no such algorithm exceptionjava.security.cert.CertificateException
- the certificate exceptionjava.security.KeyStoreException
- the key store exceptionpublic com.nimbusds.oauth2.sdk.token.AccessToken getAccessToken()
public void dumpTokenInfo() throws com.nimbusds.oauth2.sdk.ParseException, java.text.ParseException
com.nimbusds.oauth2.sdk.ParseException
- the nimbusds parse exceptionjava.text.ParseException
- the java text parse exceptionpublic void requestUserInfo() throws java.security.KeyManagementException, java.security.NoSuchAlgorithmException, java.security.cert.CertificateException, java.security.KeyStoreException, com.nimbusds.oauth2.sdk.ParseException, java.io.FileNotFoundException, java.io.IOException
java.security.KeyManagementException
- the key management exceptionjava.security.NoSuchAlgorithmException
- the no such algorithm exceptionjava.security.cert.CertificateException
- the certificate exceptionjava.security.KeyStoreException
- the key store exceptioncom.nimbusds.oauth2.sdk.ParseException
- the parse exceptionjava.io.FileNotFoundException
- the file not found exceptionjava.io.IOException
- Signals that an I/O exception has occurred.public com.nimbusds.jwt.JWTClaimsSet getIdClaims()
java.text.ParseException
- the java text parse exceptionpublic net.minidev.json.JSONObject getUserInfoJSON()
public void setTrustStore(java.io.File trustStoreFile)
trustStoreFile
- the new trust store