Copyright | (c) Hemanth Kapila, 2014 |
---|---|
License | BSD3 |
Maintainer | saihemanth@gmail.com |
Stability | Experimental |
Safe Haskell | None |
Language | Haskell2010 |
Provides API to request password token from WindowsAzure ACS. The security token is needed by web applications and services that handle authentication using ACS. Please refer to ACS Management Service API for further information on ACS.
Following piece of code illustrates the use of API
import Web.WindowsAzure.ACS import Network.HTTP.Conduit import Network.HTTP.Client.Conduit import Network.Connection (TLSSettings (..)) import qualified Data.ByteString.Char8 as C import Control.Concurrent main = do acsCtx <- acsContext (AcsInfo "blahblah-sb" (C.pack "http://blahblah.servicebus.windows.net/" ) (C.pack "owner") (C.pack "blahBlahBlahBlah")) manager <- newManagerSettings (mkManagerSettings (TLSSettingsSimple True False False) Nothing) t1 <- acsToken manager acsCtx print t1
- data AcsInfo = AcsInfo String !ByteString !ByteString !ByteString
- data AcsContext
- type AcsToken = Header
- acsContext :: AcsInfo -> IO AcsContext
- acsToken :: Manager -> AcsContext -> IO AcsToken
Types
Acs Info
AcsInfo
encapsulates the information needed to get the token from Azure ACS:
- acs namespace
- the relying party address
- the issuer and
- the issuer key.
Acs Context
data AcsContext Source
An abstract datatype that keeps track of acs token expiry and gets a new one as necessary.
functions
acsContext :: AcsInfo -> IO AcsContext Source
construct the context object. This call does not perform any network call yet.
acsToken :: Manager -> AcsContext -> IO AcsToken Source
If a valid token is available, it is returned. Otherwise, requests password a fresh password token from windows azure acs
Refer to HTTP Conduit for information about creating and using Manager