Class DefaultUserInfoRequestEncoder
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- net.shibboleth.idp.plugin.authn.oidc.rp.encoding.impl.AbstractRequestEncoderFunction
-
- net.shibboleth.idp.plugin.authn.oidc.rp.encoding.impl.DefaultUserInfoRequestEncoder
-
- All Implemented Interfaces:
Function<ProfileRequestContext,org.apache.http.client.methods.HttpUriRequest>,Component,DestructableComponent,InitializableComponent
public class DefaultUserInfoRequestEncoder extends AbstractRequestEncoderFunction
Default encoder for UserInfo requests. Supports either GET or POST requests.
-
-
Field Summary
Fields Modifier and Type Field Description private Function<ProfileRequestContext,OAuth2AuthorizationProfileConfiguration.HttpRequestMethod>httpMethodLookupStrategyStrategy used to look up theHttpMethodused for this request.private static StringHTTPSThe HTTPS scheme.private org.slf4j.LoggerlogClass logger.private Function<ProfileRequestContext,AccessTokenResponseContext>tokenResponseContextLookupStrategyStrategy used to look up theAccessTokenResponseContextto set the parameters for.
-
Constructor Summary
Constructors Constructor Description DefaultUserInfoRequestEncoder()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddBearerTokenToGet(org.apache.http.client.methods.RequestBuilder rb, AccessTokenResponseContext responseCtx)Add the bearer token to the Authorization header, used when issuing HTTP GET requests.private voidaddBearerTokenToPost(org.apache.http.client.methods.RequestBuilder rb, AccessTokenResponseContext responseCtx)Add the bearer token to the 'access_token' parameter, used when issuing HTTP POST requests.org.apache.http.client.methods.HttpUriRequestdoApply(ProfileRequestContext profileRequestContext)Encode a HttpUriRequest from the given context.voidsetHttpMethodLookupStrategy(Function<ProfileRequestContext,OAuth2AuthorizationProfileConfiguration.HttpRequestMethod> strategy)Set the strategy used to lookup the HTTP method to use in this request.voidsetTokenResponseContextLookupStrategy(Function<ProfileRequestContext,AccessTokenResponseContext> strategy)Set the strategy used to lookup theAccessTokenResponseContext.-
Methods inherited from class net.shibboleth.idp.plugin.authn.oidc.rp.encoding.impl.AbstractRequestEncoderFunction
apply, getAuthenticationRequest, getAuthenticationResponse, getClientAuthenticationContext, getProviderMetadataContext, setOIDCClientAuthenticationContextContextLookupStrategy, setProviderMetadataLookupStrategy
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, doInitialize, initialize, isDestroyed, isInitialized
-
-
-
-
Field Detail
-
HTTPS
@Nonnull @NotEmpty private static final String HTTPS
The HTTPS scheme.- See Also:
- Constant Field Values
-
log
@Nonnull private final org.slf4j.Logger log
Class logger.
-
tokenResponseContextLookupStrategy
@Nonnull private Function<ProfileRequestContext,AccessTokenResponseContext> tokenResponseContextLookupStrategy
Strategy used to look up theAccessTokenResponseContextto set the parameters for.
-
httpMethodLookupStrategy
@Nonnull private Function<ProfileRequestContext,OAuth2AuthorizationProfileConfiguration.HttpRequestMethod> httpMethodLookupStrategy
Strategy used to look up theHttpMethodused for this request.
-
-
Method Detail
-
setTokenResponseContextLookupStrategy
public void setTokenResponseContextLookupStrategy(Function<ProfileRequestContext,AccessTokenResponseContext> strategy)
Set the strategy used to lookup theAccessTokenResponseContext.- Parameters:
strategy- the strategy
-
setHttpMethodLookupStrategy
public void setHttpMethodLookupStrategy(Function<ProfileRequestContext,OAuth2AuthorizationProfileConfiguration.HttpRequestMethod> strategy)
Set the strategy used to lookup the HTTP method to use in this request.- Parameters:
strategy- the strategy
-
doApply
public org.apache.http.client.methods.HttpUriRequest doApply(@Nonnull ProfileRequestContext profileRequestContext)Description copied from class:AbstractRequestEncoderFunctionEncode a HttpUriRequest from the given context. Implementations should override this method.- Specified by:
doApplyin classAbstractRequestEncoderFunction- Parameters:
profileRequestContext- the profile request context.- Returns:
- the request to execute.
-
addBearerTokenToPost
private void addBearerTokenToPost(@Nonnull org.apache.http.client.methods.RequestBuilder rb, @Nonnull AccessTokenResponseContext responseCtx) throws OIDCRPExceptionAdd the bearer token to the 'access_token' parameter, used when issuing HTTP POST requests.- Parameters:
rb- the request builder to use.responseCtx- the response context to find the access_token from.- Throws:
OIDCRPException- if there is an issue adding the bearer token to the 'access_token' parameter.
-
addBearerTokenToGet
private void addBearerTokenToGet(@Nonnull org.apache.http.client.methods.RequestBuilder rb, @Nonnull AccessTokenResponseContext responseCtx) throws OIDCRPExceptionAdd the bearer token to the Authorization header, used when issuing HTTP GET requests.- Parameters:
rb- the request builder to use.responseCtx- the response context to find the access_token from.- Throws:
OIDCRPException- if there is an issue adding the bearer token to the Authorization header.
-
-