T
- the type of object to locatepublic abstract class LocatorAdapter<T> extends Object implements Locator<T>
Locator
interface. Subclasses can override any of the
doLocate(Header)
, locate(ProtectedHeader)
, locate(JwsHeader)
, or
locate(JweHeader)
methods for type-specific logic if desired when the encountered header is an
unprotected JWT, or an integrity-protected JWT (either a JWS or JWE).Constructor and Description |
---|
LocatorAdapter()
Constructs a new instance, where all default method implementations return
null . |
Modifier and Type | Method and Description |
---|---|
protected T |
doLocate(Header header)
Returns an object referenced in the specified unprotected JWT header, or
null if the referenced
object cannot be found or does not exist. |
T |
locate(Header header)
Inspects the specified header, and delegates to the
locate(ProtectedHeader) method if the header
is protected (either a JwsHeader or JweHeader ), or the doLocate(Header) method
if the header is not integrity protected. |
protected T |
locate(JweHeader header)
Returns an object referenced in the specified JWE header, or
null if the referenced
object cannot be found or does not exist. |
protected T |
locate(JwsHeader header)
Returns an object referenced in the specified JWS header, or
null if the referenced
object cannot be found or does not exist. |
protected T |
locate(ProtectedHeader header)
Returns an object referenced in the specified
ProtectedHeader , or null if the referenced
object cannot be found or does not exist. |
public LocatorAdapter()
null
.public final T locate(Header header)
locate(ProtectedHeader)
method if the header
is protected (either a JwsHeader
or JweHeader
), or the doLocate(Header)
method
if the header is not integrity protected.locate
in interface Locator<T>
header
- the JWT header to inspect; may be an instance of Header
, JwsHeader
, or
JweHeader
depending on if the respective JWT is an unprotected JWT, JWS or JWE.null
if the referenced object cannot be found
or does not exist.protected T locate(ProtectedHeader header)
ProtectedHeader
, or null
if the referenced
object cannot be found or does not exist. This is a convenience method that delegates to
locate(JwsHeader)
if the header
is a JwsHeader
or locate(JweHeader)
if the
header
is a JweHeader
.header
- the protected header of an encountered JWS or JWE.ProtectedHeader
, or null
if the referenced
object cannot be found or does not exist.protected T locate(JweHeader header)
null
if the referenced
object cannot be found or does not exist. Default implementation simply returns null
.header
- the header of an encountered JWE.null
if the referenced
object cannot be found or does not exist.protected T locate(JwsHeader header)
null
if the referenced
object cannot be found or does not exist. Default implementation simply returns null
.header
- the header of an encountered JWS.null
if the referenced
object cannot be found or does not exist.protected T doLocate(Header header)
null
if the referenced
object cannot be found or does not exist. Default implementation simply returns null
.header
- the header of an encountered JWT.null
if the referenced
object cannot be found or does not exist.Copyright © 2014–2025 jsonwebtoken.io. All rights reserved.