ms-auth-0.3.0.0: Microsoft Authentication API
Safe HaskellSafe-Inferred
LanguageHaskell2010

Network.OAuth2.Provider.AzureAD

Description

Settings for using Azure Active Directory as OAuth identity provider

Both Auth Code Grant (i.e. with browser client interaction) and App-only (i.e. Client Credentials) authentication flows are supported. The former is useful when a user needs to login and delegate some permissions to the application (i.e. accessing personal data), whereas the second is for server processes and automation accounts.

Synopsis

Documentation

data AzureAD Source #

Instances

Instances details
Show AzureAD Source # 
Instance details

Defined in Network.OAuth2.Provider.AzureAD

Eq AzureAD Source # 
Instance details

Defined in Network.OAuth2.Provider.AzureAD

Methods

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

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

type IdpUserInfo AzureAD Source # 
Instance details

Defined in Network.OAuth2.Provider.AzureAD

Environment variables

envClientId :: MonadIO f => f ClientId Source #

AZURE_CLIENT_ID

envClientSecret :: MonadIO f => f ClientSecret Source #

AZURE_CLIENT_SECRET

envTenantId :: MonadIO f => f Text Source #

AZURE_TENANT_ID

App flow

azureADApp Source #

Arguments

:: MonadIO m 
=> Text

application name

-> [Scope]

scopes

-> m (IdpApplication 'ClientCredentials AzureAD) 

Azure OAuth application (i.e. with user consent screen)

NB : scope offline_access is ALWAYS requested

create app at https://go.microsoft.com/fwlink/?linkid=2083908

also be aware to find the right client id. see https://stackoverflow.com/a/70670961

Throws AzureADException if AZURE_CLIENT_ID and/or AZURE_CLIENT_SECRET credentials are not found in the environment

Delegated permissions OAuth2 flow

data OAuthCfg Source #

Configuration object of the OAuth2 application

Constructors

OAuthCfg 

Fields

azureOAuthADApp Source #

Arguments

:: MonadIO m 
=> OAuthCfg

OAuth configuration

-> m (IdpApplication 'AuthorizationCode AzureAD) 

Azure OAuth application (i.e. with user consent screen)

NB : scopes openid and offline_access are ALWAYS requested since the library assumes we have access to refresh tokens and ID tokens

Reference on Microsoft Graph permissions : https://learn.microsoft.com/en-us/graph/permissions-reference

create app at https://go.microsoft.com/fwlink/?linkid=2083908

also be aware to find the right client id. see https://stackoverflow.com/a/70670961

Throws AzureADException if AZURE_CLIENT_ID and/or AZURE_CLIENT_SECRET credentials are not found in the environment

Exceptions