Configuring JWT authentication
Use the following information to configure the JWT authentication according to your business requirements. You can set up JWT authentication for various endpoints. For example, REST APIs.
Before you begin
Procedure
Example
{
"iat": 1516239022,
"exp": 1531762065,
"userid" : "testuser",
"otherinfo" : { "email": "test@foo.com", "usergroup":"testGroup"}
}
Then, to specify the user path, set the property
to:yfs.yfs.jwt.defclaimparser.user.path=useridyfs.yfs.jwt.defclaimparser.user.email.path=otherinfo.emailHere, the dot (.) in the path is used to traverse to a child object in the JSON structure,
namely, to denote that the object email is child of the object
otherinfo.
<path relative to the JWT body JSON to read the user> or
<path relative to the JWT body JSON to read the user email> contain a dot (.)
character, then you must set the yfs.yfs.jwt.defclaimparser.path.delim property to
use a different delimiter other than dot (.). This is because dot is a special character that is
used as delimiter by
default.yfs.yfs.jwt.defclaimparser.path.delim=<value>Where,
<value> is a character that is not present in path
relative to the JWT body JSON to read the user or path relative to the JWT body
JSON to read the user email.
When the paths contain dots (.), you can use the
yfs.yfs.jwt.defclaimparser.path.delim property to set another delimiter to specify
the path.
{
"iat": 1516239022,
"exp": 1531762065,
"www.foo.com/userid" : "testuser",
"www.foo.com/otherinfo" : { "email": "test@foo.com", "usergroup":"testGroup"}
}yfs.yfs.jwt.defclaimparser.path.delim=$Because $ is
not present in the path, it can be used as an alternative delimiter.yfs.yfs.jwt.defclaimparser.user.path=www.foo.com/userid
yfs.yfs.jwt.defclaimparser.user.email.path=www.foo.com/otherinfo$emailHere,
the $ in the path indicates that the object email is child of the
object www.foo.com/otherinfo.