Package com.ibm.websphere.security.jwt
Class JwtConsumer
- java.lang.Object
- 
- com.ibm.websphere.security.jwt.JwtConsumer
 
- 
 public class JwtConsumer extends java.lang.ObjectThis is a class that facilitates validating and parsing JSON Web Tokens.- Since:
- 1.0
 
- 
- 
Field SummaryFields Modifier and Type Field Description static java.lang.StringDEFAULT_IDThe ID used for the defaultjwtConsumerserver configuration element that it implicitly included with thejwt-1.0feature.
 - 
Constructor SummaryConstructors Constructor Description JwtConsumer()End OSGi-related fields and methodsJwtConsumer(java.lang.String consumerConfigId)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JwtConsumercreate()Creates a newJwtConsumerobject using the default configuration ID "defaultJwtConsumer".static JwtConsumercreate(java.lang.String consumerConfigId)Creates a newJwtConsumerobject using the configuration ID provided.JwtTokencreateJwt(java.lang.String encodedTokenString)Creates a newJwtTokenobject based on the provided encoded token string.
 
- 
- 
- 
Field Detail- 
DEFAULT_IDpublic static final java.lang.String DEFAULT_ID The ID used for the defaultjwtConsumerserver configuration element that it implicitly included with thejwt-1.0feature.- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
JwtConsumerpublic JwtConsumer() End OSGi-related fields and methods
 - 
JwtConsumerpublic JwtConsumer(java.lang.String consumerConfigId) throws InvalidConsumerException- Throws:
- InvalidConsumerException
 
 
- 
 - 
Method Detail- 
createpublic static JwtConsumer create() throws InvalidConsumerException Creates a newJwtConsumerobject using the default configuration ID "defaultJwtConsumer".- Returns:
- A new JwtConsumerobject tied to thejwtConsumerserver configuration element with the default ID "defaultJwtConsumer".
- Throws:
- InvalidConsumerException- Thrown if the JWT consumer service is not available.
 
 - 
createpublic static JwtConsumer create(java.lang.String consumerConfigId) throws InvalidConsumerException Creates a newJwtConsumerobject using the configuration ID provided.- Parameters:
- consumerConfigId- ID of a corresponding- jwtConsumerelement in- server.xml. If- null, the default configuration ID "defaultJwtConsumer" will be used.
- Returns:
- A new JwtConsumerobject tied to thejwtConsumerserver configuration element whoseidattribute matches the ID provided.
- Throws:
- InvalidConsumerException- Thrown if the JWT consumer service is not available.
 
 - 
createJwtpublic JwtToken createJwt(java.lang.String encodedTokenString) throws InvalidTokenException, InvalidConsumerException Creates a newJwtTokenobject based on the provided encoded token string. The token string is processed based on the configuration for thejwtConsumerelement that is specified inserver.xmlthat matches the ID used to instantiate thisJwtConsumerobject.- Parameters:
- encodedTokenString- JWT string to be used to create and validate a new- JwtTokenobject. The string should adhere to the format described in {@link https://tools.ietf.org/html/rfc7519#section-3}, where the string is a sequence of base64url-encoded URL-safe parts separated by period ('.') characters.
- Returns:
- A new JwtTokenobject based on the data contained in the provided token string.
- Throws:
- InvalidConsumerException- Thrown if a- jwtConsumerelement with the ID used to instantiate this- JwtConsumerobject cannot be found in the server configuration.
- InvalidTokenException- Thrown if the provided token string is- nullor empty, or if there is an error while processing the token string.
 
 
- 
 
-