public class JwtConsumer
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_ID
The ID used for the default
jwtConsumer server configuration element that it implicitly included with the
jwt-1.0 feature. |
Constructor and Description |
---|
JwtConsumer()
End OSGi-related fields and methods
|
JwtConsumer(java.lang.String consumerConfigId) |
Modifier and Type | Method and Description |
---|---|
static JwtConsumer |
create()
Creates a new
JwtConsumer object using the default configuration ID "defaultJwtConsumer". |
static JwtConsumer |
create(java.lang.String consumerConfigId)
Creates a new
JwtConsumer object using the configuration ID provided. |
JwtToken |
createJwt(java.lang.String encodedTokenString)
Creates a new
JwtToken object based on the provided encoded token string. |
public static final java.lang.String DEFAULT_ID
jwtConsumer
server configuration element that it implicitly included with the
jwt-1.0
feature.public JwtConsumer()
public JwtConsumer(java.lang.String consumerConfigId) throws InvalidConsumerException
InvalidConsumerException
public static JwtConsumer create() throws InvalidConsumerException
JwtConsumer
object using the default configuration ID "defaultJwtConsumer".JwtConsumer
object tied to the jwtConsumer
server configuration element with the default ID
"defaultJwtConsumer".InvalidConsumerException
- Thrown if the JWT consumer service is not available.public static JwtConsumer create(java.lang.String consumerConfigId) throws InvalidConsumerException
JwtConsumer
object using the configuration ID provided.consumerConfigId
- ID of a corresponding jwtConsumer
element in server.xml
. If null
, the default
configuration ID "defaultJwtConsumer" will be used.JwtConsumer
object tied to the jwtConsumer
server configuration element whose id
attribute matches the ID provided.InvalidConsumerException
- Thrown if the JWT consumer service is not available.public JwtToken createJwt(java.lang.String encodedTokenString) throws InvalidTokenException, InvalidConsumerException
JwtToken
object based on the provided encoded token string. The token string is processed based on
the configuration for the jwtConsumer
element that is specified in server.xml
that matches the ID used to
instantiate this JwtConsumer
object.encodedTokenString
- JWT string to be used to create and validate a new JwtToken
object. The string should
adhere to the format described in https://tools.ietf.org/html/rfc7519#section-3
, where the string is a
sequence of base64url-encoded URL-safe parts separated by period ('.') characters.JwtToken
object based on the data contained in the provided token string.InvalidConsumerException
- Thrown if a jwtConsumer
element with the ID used to instantiate this JwtConsumer
object cannot
be found in the server configuration.InvalidTokenException
- Thrown if the provided token string is null
or empty, or if there is an error while processing the
token string.