Karate Tools will generate a JWT token based on default JWT data defined in
src/test/resources/jwt/default-jwt.ymland will send the HTTP requests with the JWT token as Bearer in the "Authorization" header.
User specific data for JWT generation can be defined in src/test/resources/jwt/<username>-jwt.yml files.
|
Configuration
The default settings for JWT authentication are:
-
defaultAuthMode:jwt-
auth.authModewhen used in a specific request.
-
-
defaultUsername: default username.-
auth.usernamewhen used in a specific request.
-
Examples
Error Management
The errors applicable to JWT authentication are:
-
invalid authMode:>> auth >> Trying to authenticate with no authMode or invalid authMode. auth.authMode:JWT -
no username:>> auth >> Trying to authenticate with no username. auth.authMode:jwt auth.username:null -
failed to generate jwt:>> auth >> jwt >> failed to generate jwt