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,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 TypeFieldDescriptionprivate 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(T 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) 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 names in the given HTTP request into a custom parameter name.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 final org.slf4j.Logger logClass logger. -
removeIpAddressFromEndpointUri
private boolean removeIpAddressFromEndpointUriA flag to remove the IP address from the endpoint URI.
-
-
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.
-
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 names in the given HTTP request into a custom parameter name. This allows us to avoid Nimbus library's control over the values of the parameter.- Parameters:
httpRequest- The HTTP request object where the parameter names are switched
-