Safe Haskell | None |
---|---|
Language | Haskell2010 |
PostgREST.Auth
Description
This module provides functions to deal with the JWT authorization (http://jwt.io). It also can be used to define other authorization functions, in the future Oauth, LDAP and similar integrations can be coded here.
Authentication should always be implemented in an external service. In the test suite there is an example of simple login function that can be used for a very simple authentication system inside the PostgreSQL database.
- containsRole :: JWTAttempt -> Bool
- jwtClaims :: Maybe Secret -> Text -> NominalDiffTime -> JWTAttempt
- tokenJWT :: Secret -> Value -> Text
- data JWTAttempt
Documentation
containsRole :: JWTAttempt -> Bool #
Whether a response from jwtClaims contains a role claim
jwtClaims :: Maybe Secret -> Text -> NominalDiffTime -> JWTAttempt #
Receives the JWT secret (from config) and a JWT and returns a map of JWT claims.
tokenJWT :: Secret -> Value -> Text #
Receives the JWT secret (from config) and a JWT and a JSON value and returns a signed JWT.
data JWTAttempt #
Possible situations encountered with client JWTs
Constructors
JWTExpired | |
JWTInvalid | |
JWTMissingSecret | |
JWTClaims (HashMap Text Value) |
Instances