T
- the type of object to return to the parser caller after handling the parsed JWT.public class JwtHandlerAdapter<T> extends java.lang.Object implements JwtHandler<T>
JwtHandler
interface that allows for anonymous subclasses to process only the JWT results that are
known/expected for a particular use case.
All of the methods in this implementation throw exceptions: overridden methods represent scenarios expected by calling code in known situations. It would be unexpected to receive a JWS or JWT that did not match parsing expectations, so all non-overridden methods throw exceptions to indicate that the JWT input was unexpected.
构造器和说明 |
---|
JwtHandlerAdapter() |
限定符和类型 | 方法和说明 |
---|---|
T |
onClaimsJws(Jws<Claims> jws)
This method is invoked when a
JwtParser determines that the parsed JWT is
a valid Claims JWS. |
T |
onClaimsJwt(Jwt<Header,Claims> jwt)
This method is invoked when a
JwtParser determines that the parsed JWT is
a Claims JWT. |
T |
onPlaintextJws(Jws<java.lang.String> jws)
This method is invoked when a
JwtParser determines that the parsed JWT is
a plaintext JWS. |
T |
onPlaintextJwt(Jwt<Header,java.lang.String> jwt)
This method is invoked when a
JwtParser determines that the parsed JWT is
a plaintext JWT. |
public T onPlaintextJwt(Jwt<Header,java.lang.String> jwt)
JwtHandler
JwtParser
determines that the parsed JWT is
a plaintext JWT. A plaintext JWT has a String (non-JSON) body payload and it is not cryptographically signed.onPlaintextJwt
在接口中 JwtHandler<T>
jwt
- the parsed plaintext JWTnull
if no return value is necessary.public T onClaimsJwt(Jwt<Header,Claims> jwt)
JwtHandler
JwtParser
determines that the parsed JWT is
a Claims JWT. A Claims JWT has a Claims
body and it is not cryptographically signed.onClaimsJwt
在接口中 JwtHandler<T>
jwt
- the parsed claims JWTnull
if no return value is necessary.public T onPlaintextJws(Jws<java.lang.String> jws)
JwtHandler
JwtParser
determines that the parsed JWT is
a plaintext JWS. A plaintext JWS is a JWT with a String (non-JSON) body (payload) that has been
cryptographically signed.
This method will only be invoked if the cryptographic signature can be successfully verified.
onPlaintextJws
在接口中 JwtHandler<T>
jws
- the parsed plaintext JWSnull
if no return value is necessary.public T onClaimsJws(Jws<Claims> jws)
JwtHandler
JwtParser
determines that the parsed JWT is
a valid Claims JWS. A Claims JWS is a JWT with a Claims
body that has been cryptographically signed.
This method will only be invoked if the cryptographic signature can be successfully verified.
onClaimsJws
在接口中 JwtHandler<T>
jws
- the parsed claims JWSnull
if no return value is necessary.