| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Network.OAuth2.Session
Description
OAuth user session
Synopsis
- withAADUser :: MonadIO m => Tokens UserSub t -> Text -> (t -> Action m ()) -> Action m ()
- loginEndpoint :: MonadIO m => IdpApplication 'AuthorizationCode AzureAD -> RoutePattern -> Scotty m ()
- replyEndpoint :: MonadIO m => IdpApplication 'AuthorizationCode AzureAD -> Tokens UserSub OAuth2Token -> Manager -> RoutePattern -> Scotty m ()
- type Tokens uid t = TVar (TokensData uid t)
- data UserSub
- lookupUser :: (MonadIO m, Ord uid) => Tokens uid t -> uid -> m (Maybe t)
- expireUser :: (MonadIO m, Ord uid) => Tokens uid t -> uid -> m ()
- type Scotty = ScottyT Text
- type Action = ActionT Text
Azure App Service
Arguments
| :: MonadIO m | |
| => Tokens UserSub t | |
| -> Text | login URI |
| -> (t -> Action m ()) | call MSGraph APIs with token |
| -> Action m () |
Decode the App Service ID token header X-MS-TOKEN-AAD-ID-TOKEN, look its user up in the local token store, supply token t to continuation. If the user sub cannot be found in the token store the browser is redirected to the login URI.
Special case of aadHeaderIdToken
OAuth2 endpoints
Arguments
| :: MonadIO m | |
| => IdpApplication 'AuthorizationCode AzureAD | |
| -> RoutePattern | e.g. |
| -> Scotty m () |
Login endpoint
see azureADApp
Arguments
| :: MonadIO m | |
| => IdpApplication 'AuthorizationCode AzureAD | |
| -> Tokens UserSub OAuth2Token | |
| -> Manager | |
| -> RoutePattern | e.g. |
| -> Scotty m () |
The identity provider redirects the client to the reply endpoint as part of the OAuth flow : https://learn.microsoft.com/en-us/graph/auth-v2-user?view=graph-rest-1.0&tabs=http#authorization-response
see azureADApp
In-memory user session
sub field
Instances
| FromJSON UserSub Source # | |
| FromJSONKey UserSub Source # | |
Defined in Network.OAuth2.JWT Methods | |
| ToJSON UserSub Source # | |
Defined in Network.OAuth2.JWT | |
| ToJSONKey UserSub Source # | |
Defined in Network.OAuth2.JWT | |
| IsString UserSub Source # | |
Defined in Network.OAuth2.JWT Methods fromString :: String -> UserSub # | |
| Generic UserSub Source # | |
| Show UserSub Source # | |
| Eq UserSub Source # | |
| Ord UserSub Source # | |
| type Rep UserSub Source # | |
Defined in Network.OAuth2.JWT | |