Safe Haskell | None |
---|---|
Language | Haskell2010 |
Common types and functions related to authorization.
Synopsis
- type AuthorizationHeader scheme = Header Optional Lenient "Authorization" (AuthToken scheme)
- getAuthorizationHeaderTrait :: forall scheme h ts. Get h (AuthorizationHeader scheme) Request => h (Linked ts Request) (Maybe (Either Text (AuthToken scheme)))
- newtype Realm = Realm ByteString
- data AuthToken (scheme :: Symbol) = AuthToken {}
- respondUnauthorized :: (Handler h m, Sets h [Status, RequiredHeader "Content-Type" Text, RequiredHeader "WWW-Authenticate" Text, Body Text] Response) => CI ByteString -> Realm -> h a Response
Documentation
type AuthorizationHeader scheme = Header Optional Lenient "Authorization" (AuthToken scheme) Source #
Trait for "Authorization" header
getAuthorizationHeaderTrait :: forall scheme h ts. Get h (AuthorizationHeader scheme) Request => h (Linked ts Request) (Maybe (Either Text (AuthToken scheme))) Source #
Extract the "Authorization" header from a request by specifying an authentication scheme.
The header is split into the scheme and token parts and returned.
The protection space for authentication
data AuthToken (scheme :: Symbol) Source #
The components of Authorization request header
AuthToken | |
|
Instances
KnownSymbol scheme => FromHttpApiData (AuthToken scheme) Source # | |
Defined in WebGear.Core.Trait.Auth.Common parseUrlPiece :: Text -> Either Text (AuthToken scheme) # parseHeader :: ByteString -> Either Text (AuthToken scheme) # |
:: (Handler h m, Sets h [Status, RequiredHeader "Content-Type" Text, RequiredHeader "WWW-Authenticate" Text, Body Text] Response) | |
=> CI ByteString | The authentication scheme |
-> Realm | The authentication realm |
-> h a Response |
Create a "401 Unauthorized" response.
The response will have a plain text body and an appropriate "WWW-Authenticate" header.