JwtRolesMapper

fun interface JwtRolesMapper

Maps a decoded JWT to the set of RouteRoles granted to the caller.

The resulting set is passed as the roles argument to io.github.mzlnk.javalin.security.authentication.Authentication.authenticated and is used by declared-role routes and authorization rules such as hasRole. Applied for both the default Jwt identity and a custom JwtIdentityMapper. Register via the jwt { } block (rolesMapper); the default when unset is noRoles. Custom mappers receive a verified DecodedJwt and may read any claim.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
abstract fun map(token: DecodedJwt): Set<RouteRole>

Returns the RouteRoles granted for the given verified token.