Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This is a sample application composed of the end-points in SAML.WebSSO.API plus a minimum of functionality to make a running web application. Some parts of this module could be handy to build other apps, but it is more likely to serve as a tutorial.
Synopsis
- newtype SimpleSP a = SimpleSP (ReaderT SimpleSPCtx (ExceptT SimpleError IO) a)
- data SimpleSPCtx = SimpleSPCtx {}
- type RequestStore = Map (ID AuthnRequest) Time
- type AssertionStore = Map (ID Assertion) Time
- spctxReq :: Lens' SimpleSPCtx (MVar RequestStore)
- spctxIdP :: Lens' SimpleSPCtx [IdPConfig_]
- spctxConfig :: Lens' SimpleSPCtx Config
- spctxAss :: Lens' SimpleSPCtx (MVar AssertionStore)
- type MonadApp m = (GetAllIdPs SimpleError m, SPHandler SimpleError m)
- runSimpleSP :: SimpleSPCtx -> SimpleSP a -> IO (Either SimpleError a)
- mkSimpleSPCtx :: Config -> [IdPConfig_] -> IO SimpleSPCtx
- simpleStoreID :: (MonadIO m, MonadReader ctx m) => Lens' ctx (MVar (Map (ID a) Time)) -> ID a -> Time -> m ()
- simpleStoreID' :: ID a -> Time -> Map (ID a) Time -> Map (ID a) Time
- simpleUnStoreID :: (MonadIO m, MonadReader ctx m) => Lens' ctx (MVar (Map (ID a) Time)) -> ID a -> m ()
- simpleUnStoreID' :: ID a -> Map (ID a) Time -> Map (ID a) Time
- simpleIsAliveID :: (MonadIO m, MonadReader ctx m, SP m) => Lens' ctx (MVar (Map (ID a) Time)) -> ID a -> m Bool
- simpleIsAliveID' :: Time -> ID a -> Map (ID a) Time -> Bool
- simpleGetIdPConfigBy :: (MonadError (Error err) m, HasConfig m, Show a, Ord a) => m [IdPConfig_] -> (IdPConfig_ -> a) -> a -> m IdPConfig_
- class SPStoreIdP err m => GetAllIdPs err m where
- getAllIdPs :: m [IdPConfig (IdPConfigExtra m)]
- app :: Config -> [IdPConfig_] -> IO Application
- app' :: forall (m :: Type -> Type). (SP m, MonadApp m) => Proxy m -> NTCTX m -> IO Application
- type SPAPI = (Header "Cookie" Cky :> Get '[HTML] LoginStatus) :<|> (("logout" :> ("local" :> GetRedir '[HTML] (WithCookieAndLocation ST))) :<|> ("logout" :> ("single" :> GetRedir '[HTML] (WithCookieAndLocation ST))))
- type APPAPI = ("sp" :> SPAPI) :<|> ("sso" :> API)
- spapi :: MonadApp m => ServerT SPAPI m
- appapi :: MonadApp m => ServerT APPAPI m
- loginStatus :: (GetAllIdPs err m, SP m) => Maybe Cky -> m LoginStatus
- mkLoginOption :: (Monad m, SP m) => IdPConfig a -> m (ST, ST)
- localLogout :: SPHandler SimpleError m => m (WithCookieAndLocation ST)
- singleLogout :: (HasCallStack, SP m) => m (WithCookieAndLocation ST)
- data LoginStatus
- = NotLoggedIn [(ST, ST)]
- | LoggedInAs ST ST
- data Path
- getPath' :: forall m. (Monad m, HasConfig m) => Path -> m ST
- getPath :: forall m. (Monad m, HasConfig m) => Path -> m URI
Documentation
Instances
data SimpleSPCtx Source #
SimpleSPCtx | |
|
Instances
MonadReader SimpleSPCtx SimpleSP Source # | |
Defined in SAML2.WebSSO.API.Example ask :: SimpleSP SimpleSPCtx # local :: (SimpleSPCtx -> SimpleSPCtx) -> SimpleSP a -> SimpleSP a # reader :: (SimpleSPCtx -> a) -> SimpleSP a # |
type RequestStore = Map (ID AuthnRequest) Time Source #
type MonadApp m = (GetAllIdPs SimpleError m, SPHandler SimpleError m) Source #
runSimpleSP :: SimpleSPCtx -> SimpleSP a -> IO (Either SimpleError a) Source #
mkSimpleSPCtx :: Config -> [IdPConfig_] -> IO SimpleSPCtx Source #
simpleStoreID :: (MonadIO m, MonadReader ctx m) => Lens' ctx (MVar (Map (ID a) Time)) -> ID a -> Time -> m () Source #
simpleUnStoreID :: (MonadIO m, MonadReader ctx m) => Lens' ctx (MVar (Map (ID a) Time)) -> ID a -> m () Source #
simpleIsAliveID :: (MonadIO m, MonadReader ctx m, SP m) => Lens' ctx (MVar (Map (ID a) Time)) -> ID a -> m Bool Source #
simpleGetIdPConfigBy :: (MonadError (Error err) m, HasConfig m, Show a, Ord a) => m [IdPConfig_] -> (IdPConfig_ -> a) -> a -> m IdPConfig_ Source #
class SPStoreIdP err m => GetAllIdPs err m where Source #
getAllIdPs :: m [IdPConfig (IdPConfigExtra m)] Source #
Instances
GetAllIdPs SimpleError SimpleSP Source # | |
Defined in SAML2.WebSSO.API.Example | |
GetAllIdPs SimpleError TestSP Source # | |
Defined in SAML2.WebSSO.Test.Util.TestSP getAllIdPs :: TestSP [IdPConfig (IdPConfigExtra TestSP)] Source # |
app :: Config -> [IdPConfig_] -> IO Application Source #
The most straight-forward Application
that can be constructed from api
, API
.
app' :: forall (m :: Type -> Type). (SP m, MonadApp m) => Proxy m -> NTCTX m -> IO Application Source #
type SPAPI = (Header "Cookie" Cky :> Get '[HTML] LoginStatus) :<|> (("logout" :> ("local" :> GetRedir '[HTML] (WithCookieAndLocation ST))) :<|> ("logout" :> ("single" :> GetRedir '[HTML] (WithCookieAndLocation ST)))) Source #
loginStatus :: (GetAllIdPs err m, SP m) => Maybe Cky -> m LoginStatus Source #
localLogout :: SPHandler SimpleError m => m (WithCookieAndLocation ST) Source #
only logout on this SP.
singleLogout :: (HasCallStack, SP m) => m (WithCookieAndLocation ST) Source #
as in [3/4.4]
data LoginStatus Source #
NotLoggedIn [(ST, ST)] | |
LoggedInAs ST ST |
Instances
Show LoginStatus Source # | |
Defined in SAML2.WebSSO.API.Example showsPrec :: Int -> LoginStatus -> ShowS # show :: LoginStatus -> String # showList :: [LoginStatus] -> ShowS # | |
Eq LoginStatus Source # | |
Defined in SAML2.WebSSO.API.Example (==) :: LoginStatus -> LoginStatus -> Bool # (/=) :: LoginStatus -> LoginStatus -> Bool # | |
MimeRender HTML LoginStatus Source # | |
Defined in SAML2.WebSSO.API.Example mimeRender :: Proxy HTML -> LoginStatus -> ByteString Source # |