Class UserInfoResponseDecoder
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.oidc.profile.decoding.impl.AbstractJSONResponseDecoderFunction<com.nimbusds.openid.connect.sdk.UserInfoResponse>
net.shibboleth.oidc.profile.decoding.impl.UserInfoResponseDecoder
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,org.apache.hc.core5.http.io.HttpClientResponseHandler<com.nimbusds.openid.connect.sdk.UserInfoResponse>
public class UserInfoResponseDecoder
extends AbstractJSONResponseDecoderFunction<com.nimbusds.openid.connect.sdk.UserInfoResponse>
A UserInfo response decoder. Supports both plain JSON Object and JWT responses.
Importantly,the decoder *must not ever* decode a JWT response as a plain response type, otherwise the signature
check may not be performed downstream - although other validation for the plain object type should. That is, we
can not rely solely on the content-type header in-case of content-type header injection attacks — the logic
that builds either the JWT or plain response should fail, or at least present an invalid UserInfo response token.
Any decoding error is logged and null is returned.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.slf4j.LoggerClass logger.static final StringThe UserInfo response header that carries error information.Fields inherited from class net.shibboleth.oidc.profile.decoding.impl.AbstractJSONResponseDecoderFunction
BASE_PROTOCOL_MESSAGE_LOGGER_CATEGORY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.nimbusds.openid.connect.sdk.UserInfoResponsedoHandleResponse(org.apache.hc.core5.http.ClassicHttpResponse httpResponse) Do the actual response processing and return a result.protected StringserializeMessageForLogging(com.nimbusds.openid.connect.sdk.UserInfoResponse response) Serialize the message for logging purposes.Methods inherited from class net.shibboleth.oidc.profile.decoding.impl.AbstractJSONResponseDecoderFunction
doInitialize, getObjectMapper, getProtocolMessageForErrorObject, getProtocolMessageLoggerSubCategory, handleResponse, logDecodedMessage, setObjectMapper, setProtocolMessageLoggerSubCategoryMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitialized
-
Field Details
-
USERINFO_ERROR_RESPONSE_HEADER
The UserInfo response header that carries error information.- See Also:
-
log
@Nonnull private final org.slf4j.Logger logClass logger.
-
-
Constructor Details
-
UserInfoResponseDecoder
public UserInfoResponseDecoder()Constructor.
-
-
Method Details
-
doHandleResponse
public com.nimbusds.openid.connect.sdk.UserInfoResponse doHandleResponse(@Nullable org.apache.hc.core5.http.ClassicHttpResponse httpResponse) Description copied from class:AbstractJSONResponseDecoderFunctionDo the actual response processing and return a result. Overridden by implementation classes.- Specified by:
doHandleResponsein classAbstractJSONResponseDecoderFunction<com.nimbusds.openid.connect.sdk.UserInfoResponse>- Parameters:
httpResponse- the http response
-
serializeMessageForLogging
protected String serializeMessageForLogging(@Nullable com.nimbusds.openid.connect.sdk.UserInfoResponse response) Serialize the message for logging purposes.Default implementation is to return the message object's
Object.toString(), but subclasses should override if a better message-specific serialization mechanism exists.- Overrides:
serializeMessageForLoggingin classAbstractJSONResponseDecoderFunction<com.nimbusds.openid.connect.sdk.UserInfoResponse>- Parameters:
response- the response message to serialize- Returns:
- the serialized message, or null if message can not be serialized
-