servant-auth-client-0.4.1.1: servant-client/servant-auth compatibility
Safe HaskellSafe-Inferred
LanguageHaskell2010

Servant.Auth.Client.Internal

Synopsis

Documentation

newtype Token Source #

A simple bearer token.

Constructors

Token 

Fields

Instances

Instances details
IsString Token Source # 
Instance details

Defined in Servant.Auth.Client.Internal

Methods

fromString :: String -> Token #

Generic Token Source # 
Instance details

Defined in Servant.Auth.Client.Internal

Associated Types

type Rep Token :: Type -> Type #

Methods

from :: Token -> Rep Token x #

to :: Rep Token x -> Token #

Read Token Source # 
Instance details

Defined in Servant.Auth.Client.Internal

Show Token Source # 
Instance details

Defined in Servant.Auth.Client.Internal

Methods

showsPrec :: Int -> Token -> ShowS #

show :: Token -> String #

showList :: [Token] -> ShowS #

Eq Token Source # 
Instance details

Defined in Servant.Auth.Client.Internal

Methods

(==) :: Token -> Token -> Bool #

(/=) :: Token -> Token -> Bool #

type Rep Token Source # 
Instance details

Defined in Servant.Auth.Client.Internal

type Rep Token = D1 ('MetaData "Token" "Servant.Auth.Client.Internal" "servant-auth-client-0.4.1.1-4t9HraVHBC38VZTfJqhCbO" 'True) (C1 ('MetaCons "Token" 'PrefixI 'True) (S1 ('MetaSel ('Just "getToken") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))

type family HasBearer xs :: Constraint where ... Source #

Equations

HasBearer (Bearer ': xs) = () 
HasBearer (JWT ': xs) = () 
HasBearer (x ': xs) = HasBearer xs 
HasBearer '[] = BearerAuthNotEnabled 

Authentication combinators

data Bearer Source #

A Bearer token in the Authorization header:

Authorization: Bearer token

This can be any token recognized by the server, for example, a JSON Web Token (JWT).

Note that, since the exact way the token is validated is not specified, this combinator can only be used in the client. The server would not know how to validate it, while the client does not care. If you want to implement Bearer authentication in your server, you have to choose a specific combinator, such as JWT.

Orphan instances

(HasBearer auths, HasClient m api) => HasClient m (Auth auths a :> api) Source #

HasBearer auths is nominally a redundant constraint, but ensures we're not trying to send a token to an API that doesn't accept them.

Instance details

Associated Types

type Client m (Auth auths a :> api) #

Methods

clientWithRoute :: Proxy m -> Proxy (Auth auths a :> api) -> Request -> Client m (Auth auths a :> api) #

hoistClientMonad :: Proxy m -> Proxy (Auth auths a :> api) -> (forall x. mon x -> mon' x) -> Client mon (Auth auths a :> api) -> Client mon' (Auth auths a :> api) #