ms-graph-api-0.3.0.0: Microsoft Graph API
Safe HaskellSafe-Inferred
LanguageHaskell2010

Network.OAuth2.Session

Description

OAuth user session

Synopsis

Azure App Service

withAADUser Source #

Arguments

:: MonadIO m 
=> Tokens UserSub t 
-> Text

login URI

-> (t -> Action m ())

call MSGraph APIs with token t, etc.

-> 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

loginEndpoint Source #

Arguments

:: MonadIO m 
=> IdpApplication 'AuthorizationCode AzureAD 
-> RoutePattern

e.g. "/login"

-> Scotty m () 

Login endpoint

see azureADApp

replyEndpoint Source #

Arguments

:: MonadIO m 
=> IdpApplication 'AuthorizationCode AzureAD 
-> Tokens UserSub OAuth2Token 
-> Manager 
-> RoutePattern

e.g. "/oauth/reply"

-> 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

type Tokens uid t = TVar (TokensData uid t) Source #

transactional token store

data UserSub Source #

sub field

Instances

Instances details
FromJSON UserSub Source # 
Instance details

Defined in Network.OAuth2.JWT

FromJSONKey UserSub Source # 
Instance details

Defined in Network.OAuth2.JWT

ToJSON UserSub Source # 
Instance details

Defined in Network.OAuth2.JWT

ToJSONKey UserSub Source # 
Instance details

Defined in Network.OAuth2.JWT

IsString UserSub Source # 
Instance details

Defined in Network.OAuth2.JWT

Methods

fromString :: String -> UserSub #

Generic UserSub Source # 
Instance details

Defined in Network.OAuth2.JWT

Associated Types

type Rep UserSub :: Type -> Type #

Methods

from :: UserSub -> Rep UserSub x #

to :: Rep UserSub x -> UserSub #

Show UserSub Source # 
Instance details

Defined in Network.OAuth2.JWT

Eq UserSub Source # 
Instance details

Defined in Network.OAuth2.JWT

Methods

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

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

Ord UserSub Source # 
Instance details

Defined in Network.OAuth2.JWT

type Rep UserSub Source # 
Instance details

Defined in Network.OAuth2.JWT

type Rep UserSub = D1 ('MetaData "UserSub" "Network.OAuth2.JWT" "ms-graph-api-0.3.0.0-J8fAZ9YhmoPK6rVlP5rmuG" 'True) (C1 ('MetaCons "UserSub" 'PrefixI 'True) (S1 ('MetaSel ('Just "userSub") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

lookupUser Source #

Arguments

:: (MonadIO m, Ord uid) 
=> Tokens uid t 
-> uid

user identifier e.g. sub

-> m (Maybe t) 

expireUser Source #

Arguments

:: (MonadIO m, Ord uid) 
=> Tokens uid t 
-> uid

user identifier e.g. sub

-> m () 

Scotty misc