Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Settings for using Azure Active Directory as OAuth identity provider
Both Auth Code Grant
(i.e. with browser client interaction) and Client Credentials Grant
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.
Azure Bot Framework is supported since v 0.4
Synopsis
- data AzureAD
- envClientId :: MonadIO f => f ClientId
- envClientSecret :: MonadIO f => f ClientSecret
- envTenantId :: MonadIO f => f Text
- azureADApp :: MonadIO m => Text -> [Scope] -> m (IdpApplication 'ClientCredentials AzureAD)
- azureBotFrameworkADApp :: MonadIO m => Text -> m (IdpApplication 'ClientCredentials AzureAD)
- data OAuthCfg = OAuthCfg {
- oacAppName :: Text
- oacScopes :: [Scope]
- oacAuthState :: AuthorizeState
- oacRedirectURI :: URI
- data AzureADUser
- azureOAuthADApp :: MonadIO m => OAuthCfg -> m (IdpApplication 'AuthorizationCode AzureAD)
- data AzureADException = AADNoEnvVar String
Documentation
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
Client Credentials auth flow
:: MonadIO m | |
=> Text | application name |
-> [Scope] | scopes |
-> m (IdpApplication 'ClientCredentials AzureAD) |
Azure OAuth application
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
azureBotFrameworkADApp Source #
:: MonadIO m | |
=> Text | app name |
-> m (IdpApplication 'ClientCredentials AzureAD) |
Initialize an Client Credentials token exchange application for the Bot Framework
Throws AzureADException
if AZURE_CLIENT_ID
and/or AZURE_CLIENT_SECRET
credentials are not found in the environment
Auth Code Grant auth flow
Configuration object of the OAuth2 application
OAuthCfg | |
|
data AzureADUser Source #
Instances
FromJSON AzureADUser Source # | |
Defined in Network.OAuth2.Provider.AzureAD parseJSON :: Value -> Parser AzureADUser # parseJSONList :: Value -> Parser [AzureADUser] # | |
Show AzureADUser Source # | |
Defined in Network.OAuth2.Provider.AzureAD showsPrec :: Int -> AzureADUser -> ShowS # show :: AzureADUser -> String # showList :: [AzureADUser] -> ShowS # | |
Eq AzureADUser Source # | |
Defined in Network.OAuth2.Provider.AzureAD (==) :: AzureADUser -> AzureADUser -> Bool # (/=) :: AzureADUser -> AzureADUser -> Bool # | |
Ord AzureADUser Source # | |
Defined in Network.OAuth2.Provider.AzureAD compare :: AzureADUser -> AzureADUser -> Ordering # (<) :: AzureADUser -> AzureADUser -> Bool # (<=) :: AzureADUser -> AzureADUser -> Bool # (>) :: AzureADUser -> AzureADUser -> Bool # (>=) :: AzureADUser -> AzureADUser -> Bool # max :: AzureADUser -> AzureADUser -> AzureADUser # min :: AzureADUser -> AzureADUser -> AzureADUser # |
:: 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
data AzureADException Source #
Instances
Exception AzureADException Source # | |
Defined in Network.OAuth2.Provider.AzureAD | |
Show AzureADException Source # | |
Defined in Network.OAuth2.Provider.AzureAD showsPrec :: Int -> AzureADException -> ShowS # show :: AzureADException -> String # showList :: [AzureADException] -> ShowS # |