Class BaseOAuth2RequestDecoder<T extends com.nimbusds.oauth2.sdk.Request>
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.messaging.decoder.AbstractMessageDecoder
org.opensaml.messaging.decoder.servlet.AbstractHttpServletRequestMessageDecoder
net.shibboleth.idp.plugin.oidc.op.oauth2.decoding.impl.BaseOAuth2RequestDecoder<T>
- Type Parameters:
T- The exact type of the request message, extendsRequest.
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,UnmodifiableComponent,MessageDecoder,HttpServletRequestMessageDecoder
- Direct Known Subclasses:
OAuth2AuthorizationRequestDecoder,OAuth2IntrospectionRequestDecoder,OAuth2PushedAuthorizationRequestDecoder,OAuth2RevocationRequestDecoder,OIDCAuthenticationRequestDecoder,OIDCClientRegistrationRequestDecoder,OIDCLogoutRequestDecoder,OIDCTokenRequestDecoder,OIDCUserInfoRequestDecoder
public abstract class BaseOAuth2RequestDecoder<T extends com.nimbusds.oauth2.sdk.Request>
extends AbstractHttpServletRequestMessageDecoder
Base decoder for Nimbus OAuth2 request messages.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CustomNimbusRequestParser<T>A custom extension for parsing Nimbus object out of the servlet request.private static final org.slf4j.LoggerClass logger.private booleanA flag to remove the IP address from the endpoint URI.Fields inherited from class org.opensaml.messaging.decoder.AbstractMessageDecoder
BASE_PROTOCOL_MESSAGE_LOGGER_CATEGORY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoDecode()protected StringgetEndpointURI(com.nimbusds.oauth2.sdk.Request message) Returns the endpoint URI either from servlet request or from the given message, depending on the flag for removing IP address from the endpoint URI.protected abstract StringgetMessageToLog(T message) Get the string representation of what will be logged as the protocol message.protected abstract TParses the message into the exact type of the request message.protected StringserializeMessageForLogging(Object message) voidsetCustomRequestParser(CustomNimbusRequestParser<T> customParser) Set the custom extension for parsing Nimbus object out of the servlet request.voidsetRemoveIpAddressFromEndpointUri(boolean flag) Set the flag to remove the IP address from the endpoint URI.protected voidswitchIntoCustomResource(com.nimbusds.oauth2.sdk.http.HTTPRequest httpRequest) Switches the 'resource' parameter values in the given HTTP request body to contain a custom parameter prefix.static StringtransformResourceParameter(String string) Transforms the 'resource' parameter values in the given input to contain a prefix defined byDefaultRequestAudienceLookupFunction.CUSTOM_RESOURCE_PARAM_PREFIX.Methods inherited from class org.opensaml.messaging.decoder.servlet.AbstractHttpServletRequestMessageDecoder
doInitialize, getHttpServletRequest, getHttpServletRequestSupplier, setHttpServletRequestSupplierMethods inherited from class org.opensaml.messaging.decoder.AbstractMessageDecoder
decode, getMessageContext, getMessageToLog, getProtocolMessageLogger, getProtocolMessageLoggerSubCategory, logDecodedMessage, setMessageContext, setProtocolMessageLoggerSubCategoryMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.DestructableComponent
destroy, isDestroyedMethods inherited from interface net.shibboleth.shared.component.InitializableComponent
initialize, isInitializedMethods inherited from interface org.opensaml.messaging.decoder.MessageDecoder
decode, getMessageContext
-
Field Details
-
log
@Nonnull private static final org.slf4j.Logger logClass logger. -
removeIpAddressFromEndpointUri
private boolean removeIpAddressFromEndpointUriA flag to remove the IP address from the endpoint URI. -
customRequestParser
@Nullable protected CustomNimbusRequestParser<T extends com.nimbusds.oauth2.sdk.Request> customRequestParserA custom extension for parsing Nimbus object out of the servlet request.
-
-
Constructor Details
-
BaseOAuth2RequestDecoder
public BaseOAuth2RequestDecoder()Constructor.
-
-
Method Details
-
setRemoveIpAddressFromEndpointUri
public void setRemoveIpAddressFromEndpointUri(boolean flag) Set the flag to remove the IP address from the endpoint URI.- Parameters:
flag- What to set.
-
setCustomRequestParser
Set the custom extension for parsing Nimbus object out of the servlet request.- Parameters:
customParser- What to set.
-
doDecode
- Specified by:
doDecodein classAbstractMessageDecoder- Throws:
MessageDecodingException
-
parseMessage
Parses the message into the exact type of the request message.- Returns:
- The request message
- Throws:
MessageDecodingException- if there is a problem decoding the message context
-
getMessageToLog
Get the string representation of what will be logged as the protocol message.- Parameters:
message- the request message- Returns:
- the string representing the protocol message for logging purposes
-
serializeMessageForLogging
- Overrides:
serializeMessageForLoggingin classAbstractMessageDecoder
-
getEndpointURI
Returns the endpoint URI either from servlet request or from the given message, depending on the flag for removing IP address from the endpoint URI.- Parameters:
message- the message from which to take the endpoint URI (with IP address), if the flag is false- Returns:
- the endpoint URI
-
switchIntoCustomResource
protected void switchIntoCustomResource(@Nonnull com.nimbusds.oauth2.sdk.http.HTTPRequest httpRequest) Switches the 'resource' parameter values in the given HTTP request body to contain a custom parameter prefix. This allows us to avoid Nimbus library's strict requirement of URI values for the parameter.- Parameters:
httpRequest- The HTTP request object where the parameter values are prefixed
-
transformResourceParameter
Transforms the 'resource' parameter values in the given input to contain a prefix defined byDefaultRequestAudienceLookupFunction.CUSTOM_RESOURCE_PARAM_PREFIX.- Parameters:
string- the input- Returns:
- the input with resource parameter values transformed having the custom prefix.
-