Class OpenIdConfiguration
- java.lang.Object
-
- org.eclipse.jetty.util.component.AbstractLifeCycle
-
- org.eclipse.jetty.util.component.ContainerLifeCycle
-
- org.eclipse.jetty.security.openid.OpenIdConfiguration
-
- All Implemented Interfaces:
Container
,Destroyable
,Dumpable
,Dumpable.DumpableContainer
,LifeCycle
public class OpenIdConfiguration extends ContainerLifeCycle
Holds the configuration for an OpenID Connect service. This uses the OpenID Provider URL with the pathCONFIG_PATH
to discover the required information about the OIDC service.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
Container.InheritedListener, Container.Listener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
authEndpoint
private java.lang.String
authMethod
private java.lang.String
clientId
private java.lang.String
clientSecret
private static java.lang.String
CONFIG_PATH
private HttpClient
httpClient
private java.lang.String
issuer
private static Logger
LOG
private java.util.List<java.lang.String>
scopes
private java.lang.String
tokenEndpoint
-
Constructor Summary
Constructors Constructor Description OpenIdConfiguration(java.lang.String provider, java.lang.String clientId, java.lang.String clientSecret)
Create an OpenID configuration for a specific OIDC provider.OpenIdConfiguration(java.lang.String issuer, java.lang.String authorizationEndpoint, java.lang.String tokenEndpoint, java.lang.String clientId, java.lang.String clientSecret, java.lang.String authMethod, HttpClient httpClient)
Create an OpenID configuration for a specific OIDC provider.OpenIdConfiguration(java.lang.String issuer, java.lang.String authorizationEndpoint, java.lang.String tokenEndpoint, java.lang.String clientId, java.lang.String clientSecret, HttpClient httpClient)
Create an OpenID configuration for a specific OIDC provider.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addScopes(java.lang.String... scopes)
protected void
doStart()
Starts the managed lifecycle beans in the order they were added.private static java.util.Map<java.lang.String,java.lang.Object>
fetchOpenIdConnectMetadata(java.lang.String provider, HttpClient httpClient)
java.lang.String
getAuthEndpoint()
java.lang.String
getAuthMethod()
java.lang.String
getClientId()
java.lang.String
getClientSecret()
HttpClient
getHttpClient()
java.lang.String
getIssuer()
java.util.List<java.lang.String>
getScopes()
java.lang.String
getTokenEndpoint()
private static HttpClient
newHttpClient()
-
Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, doStop, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpObjects, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans
-
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpable
-
-
-
-
Field Detail
-
LOG
private static final Logger LOG
-
CONFIG_PATH
private static final java.lang.String CONFIG_PATH
- See Also:
- Constant Field Values
-
httpClient
private final HttpClient httpClient
-
issuer
private final java.lang.String issuer
-
clientId
private final java.lang.String clientId
-
clientSecret
private final java.lang.String clientSecret
-
scopes
private final java.util.List<java.lang.String> scopes
-
authMethod
private final java.lang.String authMethod
-
authEndpoint
private java.lang.String authEndpoint
-
tokenEndpoint
private java.lang.String tokenEndpoint
-
-
Constructor Detail
-
OpenIdConfiguration
public OpenIdConfiguration(java.lang.String provider, java.lang.String clientId, java.lang.String clientSecret)
Create an OpenID configuration for a specific OIDC provider.- Parameters:
provider
- The URL of the OpenID provider.clientId
- OAuth 2.0 Client Identifier valid at the Authorization Server.clientSecret
- The client secret known only by the Client and the Authorization Server.
-
OpenIdConfiguration
public OpenIdConfiguration(java.lang.String issuer, java.lang.String authorizationEndpoint, java.lang.String tokenEndpoint, java.lang.String clientId, java.lang.String clientSecret, HttpClient httpClient)
Create an OpenID configuration for a specific OIDC provider.- Parameters:
issuer
- The URL of the OpenID provider.authorizationEndpoint
- the URL of the OpenID provider's authorization endpoint if configured.tokenEndpoint
- the URL of the OpenID provider's token endpoint if configured.clientId
- OAuth 2.0 Client Identifier valid at the Authorization Server.clientSecret
- The client secret known only by the Client and the Authorization Server.httpClient
- TheHttpClient
instance to use.
-
OpenIdConfiguration
public OpenIdConfiguration(java.lang.String issuer, java.lang.String authorizationEndpoint, java.lang.String tokenEndpoint, java.lang.String clientId, java.lang.String clientSecret, java.lang.String authMethod, HttpClient httpClient)
Create an OpenID configuration for a specific OIDC provider.- Parameters:
issuer
- The URL of the OpenID provider.authorizationEndpoint
- the URL of the OpenID provider's authorization endpoint if configured.tokenEndpoint
- the URL of the OpenID provider's token endpoint if configured.clientId
- OAuth 2.0 Client Identifier valid at the Authorization Server.clientSecret
- The client secret known only by the Client and the Authorization Server.authMethod
- Authentication method to use with the Token Endpoint.httpClient
- TheHttpClient
instance to use.
-
-
Method Detail
-
doStart
protected void doStart() throws java.lang.Exception
Description copied from class:ContainerLifeCycle
Starts the managed lifecycle beans in the order they were added.- Overrides:
doStart
in classContainerLifeCycle
- Throws:
java.lang.Exception
-
newHttpClient
private static HttpClient newHttpClient()
-
fetchOpenIdConnectMetadata
private static java.util.Map<java.lang.String,java.lang.Object> fetchOpenIdConnectMetadata(java.lang.String provider, HttpClient httpClient)
-
getHttpClient
public HttpClient getHttpClient()
-
getAuthEndpoint
public java.lang.String getAuthEndpoint()
-
getClientId
public java.lang.String getClientId()
-
getClientSecret
public java.lang.String getClientSecret()
-
getIssuer
public java.lang.String getIssuer()
-
getTokenEndpoint
public java.lang.String getTokenEndpoint()
-
getAuthMethod
public java.lang.String getAuthMethod()
-
addScopes
public void addScopes(java.lang.String... scopes)
-
getScopes
public java.util.List<java.lang.String> getScopes()
-
-