HTTP-4000.4.1: A library for client-side HTTP

Copyright | See LICENSE file
License | BSD
Maintainer | Ganesh Sittampalam <ganesh@earth.li>
Stability | experimental
Portability | non-portable (not tested)
Safe Haskell | Safe-Inferred
Language | Haskell98

Network.HTTP.Auth

Description

Representing HTTP Auth values in Haskell. Right now, it contains mostly functionality needed by `Browser`.

Synopsis

- data Authority
  - = AuthBasic {
    - auRealm :: String
    - auUsername :: String
    - auPassword :: String
    - auSite :: URI
    }
  - | AuthDigest {
    - auRealm :: String
    - auUsername :: String
    - auPassword :: String
    - auNonce :: String
    - auAlgorithm :: Maybe Algorithm
    - auDomain :: [URI]
    - auOpaque :: Maybe String
    - auQop :: [Qop]
    }
- data Algorithm
  - = AlgMD5
  - | AlgMD5sess
- data Challenge
  - = ChalBasic {
    - chRealm :: String
    }
  - | ChalDigest {
    - chRealm :: String
    - chDomain :: [URI]
    - chNonce :: String
    - chOpaque :: Maybe String
    - chStale :: Bool
    - chAlgorithm :: Maybe Algorithm
    - chQop :: [Qop]
    }
- data Qop
  - = QopAuth
  - | QopAuthInt
- headerToChallenge :: URI -> Header -> Maybe Challenge
- withAuthority :: Authority -> Request ty -> String

# Documentation

data Authority Source #

`Authority` specifies the HTTP Authentication method to use for a given domain/realm; `Basic` or `Digest`.

Constructors

AuthBasic |

Fields

- auRealm :: String
- auUsername :: String
- auPassword :: String
- auSite :: URI

AuthDigest |

Fields

- auRealm :: String
- auUsername :: String
- auPassword :: String
- auNonce :: String
- auAlgorithm :: Maybe Algorithm
- auDomain :: [URI]
- auOpaque :: Maybe String
- auQop :: [Qop]

data Algorithm Source #

`Algorithm` controls the digest algorithm to, `MD5` or `MD5Session`.

Constructors

AlgMD5 |
AlgMD5sess |

#### Instances

Instances details

Show Algorithm Source # |
Instance details Defined in Network.HTTP.Auth Methods showsPrec :: Int -> Algorithm -> ShowS Source # show :: Algorithm -> String Source # showList :: [Algorithm] -> ShowS Source #
Eq Algorithm Source # |
Instance details Defined in Network.HTTP.Auth Methods (==) :: Algorithm -> Algorithm -> Bool Source # (/=) :: Algorithm -> Algorithm -> Bool Source #

data Challenge Source #

Constructors

ChalBasic |

Fields

- chRealm :: String

ChalDigest |

Fields

- chRealm :: String
- chDomain :: [URI]
- chNonce :: String
- chOpaque :: Maybe String
- chStale :: Bool
- chAlgorithm :: Maybe Algorithm
- chQop :: [Qop]

data Qop Source #

Constructors

QopAuth |
QopAuthInt |

#### Instances

Instances details

Show Qop Source # |
Instance details Defined in Network.HTTP.Auth Methods showsPrec :: Int -> Qop -> ShowS Source # show :: Qop -> String Source # showList :: [Qop] -> ShowS Source #
Eq Qop Source # |
Instance details Defined in Network.HTTP.Auth Methods (==) :: Qop -> Qop -> Bool Source # (/=) :: Qop -> Qop -> Bool Source #

headerToChallenge :: URI -> Header -> Maybe Challenge Source #

`headerToChallenge base www_auth` tries to convert the `WWW-Authenticate` header `www_auth` into a `Challenge` value.

withAuthority :: Authority -> Request ty -> String Source #

`withAuthority auth req` generates a credentials value from the `auth` `Authority`, in the context of the given request.

If a client nonce was to be used then this function might need to be of type ... -> BrowserAction String