mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 18:38:26 +00:00
Allow to skip login page if a single oidc provider is configured
This commit is contained in:
@ -12,6 +12,7 @@ module Data.Flags exposing
|
||||
, getAccount
|
||||
, getToken
|
||||
, isAuthenticated
|
||||
, oidcAutoRedirect
|
||||
, withAccount
|
||||
, withoutAccount
|
||||
)
|
||||
@ -22,6 +23,7 @@ import Api.Model.AuthResult exposing (AuthResult)
|
||||
type alias OpenIdAuth =
|
||||
{ provider : String
|
||||
, name : String
|
||||
, logoutUrl : Maybe String
|
||||
}
|
||||
|
||||
|
||||
@ -39,6 +41,7 @@ type alias Config =
|
||||
, downloadAllMaxSize : Int
|
||||
, openIdAuth : List OpenIdAuth
|
||||
, addonsEnabled : Bool
|
||||
, oidcAutoRedirect : Bool
|
||||
}
|
||||
|
||||
|
||||
@ -50,6 +53,20 @@ type alias Flags =
|
||||
}
|
||||
|
||||
|
||||
oidcAutoRedirect : Flags -> Maybe OpenIdAuth
|
||||
oidcAutoRedirect flags =
|
||||
if flags.config.oidcAutoRedirect then
|
||||
case flags.config.openIdAuth of
|
||||
first :: [] ->
|
||||
Just first
|
||||
|
||||
_ ->
|
||||
Nothing
|
||||
|
||||
else
|
||||
Nothing
|
||||
|
||||
|
||||
isAuthenticated : Flags -> Bool
|
||||
isAuthenticated flags =
|
||||
getAccount flags /= Nothing
|
||||
|
Reference in New Issue
Block a user