Auth
Namespace:
Saturn
Parent:
Saturn
Module with some useful helpers functions that can be used for authentication, such as creating JWT tokens, or HttpHandlers
checking if request is authenticated.
Values and Functions
Name
|
Description
|
requireAuthentication(challengeType)
Signature:
challengeType:ChallengeType -> HttpHandler
|
Requires authentication and uses given challenge type if not authenticated
|
requireRole challengeType role
Signature:
challengeType:ChallengeType -> role:string -> HttpHandler
|
Requires role and uses given challenge type if not authenticated
|
requireRoleOf challengeType roles
Signature:
challengeType:ChallengeType -> roles:string list -> HttpHandler
|
Requires one of the roles and uses given challenge type if not authenticated
|
requireClaim challengeType claimKey claimValue
Signature:
challengeType:ChallengeType -> claimKey:string -> claimValue:string -> HttpHandler
|
Requires claim of given type with given value and uses given challenge type if not authenticated
|
generateJWT(secret, algorithm) issuer expires claims
Signature:
(secret:string * algorithm:string) -> issuer:string -> expires:DateTime -> claims:IEnumerable -> string
|
Helper function to generate JWT token using Microsoft.IdentityModel.Tokens and System.IdentityModel.Tokens.Jwt
|