Package com.authlete.jakarta
Class BaseEndpoint
- java.lang.Object
-
- com.authlete.jakarta.BaseEndpoint
-
- Direct Known Subclasses:
BaseAuthorizationDecisionEndpoint,BaseAuthorizationEndpoint,BaseBackchannelAuthenticationEndpoint,BaseClientRegistrationEndpoint,BaseConfigurationEndpoint,BaseCredentialIssuerMetadataEndpoint,BaseCredentialJwtIssuerMetadataEndpoint,BaseCredentialOfferUriEndpoint,BaseDeviceAuthorizationEndpoint,BaseDeviceCompleteEndpoint,BaseDeviceVerificationEndpoint,BaseFederationConfigurationEndpoint,BaseFederationRegistrationEndpoint,BaseIntrospectionEndpoint,BaseJwksEndpoint,BasePushedAuthReqEndpoint,BaseResourceEndpoint,BaseRevocationEndpoint,BaseTokenEndpoint
public class BaseEndpoint extends Object
A base class for endpoints.- Since:
- 1.2
- Author:
- Takahiko Kawasaki
-
-
Constructor Summary
Constructors Constructor Description BaseEndpoint()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringextractClientCertificate(jakarta.servlet.http.HttpServletRequest request)Utility method for extracting a single client certificate from the default certificate extractors.protected String[]extractClientCertificateChain(jakarta.servlet.http.HttpServletRequest request)Utility method for extracting a single client certificate from the default certificate extractors.protected com.authlete.common.dto.Pair[]extractHeadersAsPairs(jakarta.servlet.http.HttpServletRequest request)Extract headers in the HTTP request as aPairarray.protected voidonError(jakarta.ws.rs.WebApplicationException exception)Called when the internal request handler raises an exception.protected ObjecttakeAttribute(jakarta.servlet.http.HttpSession session, String key)Get the value of an attribute from the given session and remove the attribute from the session after the retrieval.
-
-
-
Method Detail
-
onError
protected void onError(jakarta.ws.rs.WebApplicationException exception)
Called when the internal request handler raises an exception. The default implementation of this method does nothing. Override this method as necessary.- Parameters:
exception- An exception thrown by the internal request handler.
-
extractClientCertificateChain
protected String[] extractClientCertificateChain(jakarta.servlet.http.HttpServletRequest request)
Utility method for extracting a single client certificate from the default certificate extractors. First checks the request itself for an attached certificate usingjakarta.servlet.request.X509Certificate, then checks the incoming request headers for reverse-proxied certificates using default headers.- Parameters:
request- The incoming HTTP request to search for the client's certificate.- Returns:
- The client's mutual TLS certificate.
- Since:
- 2.8
- See Also:
ClientCertificateExtractor
-
extractClientCertificate
protected String extractClientCertificate(jakarta.servlet.http.HttpServletRequest request)
Utility method for extracting a single client certificate from the default certificate extractors. Calls extractClientCertificateChain and returns the first entry in the array, if any, null otherwise.- Parameters:
request- The incoming HTTP request to search for the client's certificate.- Returns:
- The client's mutual TLS certificate.
- Since:
- 2.8
-
takeAttribute
protected Object takeAttribute(jakarta.servlet.http.HttpSession session, String key)
Get the value of an attribute from the given session and remove the attribute from the session after the retrieval.- Parameters:
session- The session from which the value of the attribute is extracted.key- The key associated with the target attribute.- Returns:
- The value of the attribute associated with the given key.
- Since:
- 2.18
-
extractHeadersAsPairs
protected com.authlete.common.dto.Pair[] extractHeadersAsPairs(jakarta.servlet.http.HttpServletRequest request)
Extract headers in the HTTP request as aPairarray.- Parameters:
request- An HTTP request.- Returns:
- A
Pairarray where each element represents a pair of header name and header value. If the given HTTP request contains no headers, an empty array is returned. - Since:
- 2.80
-
-