Skip to main content

generate_token

Function generate_token 

Source
pub fn generate_token(
    user: &User,
    roles: &[RoleName],
    permissions: &[PermissionName],
    config: &JwtConfig,
) -> Result<String, AuthError>
Expand description

Generate an HS256-signed JWT for the given user.

The token contains the user’s id, email, roles, and permissions as claims, plus standard exp, iat, and a unique jti.