aboutsummaryrefslogtreecommitdiff
path: root/lib/Server
diff options
context:
space:
mode:
authorstuebinm2024-07-05 22:56:52 +0200
committerstuebinm2024-07-05 22:58:16 +0200
commit2943327863bfe5c6e793e5c40e473a2755d45642 (patch)
treef3fe224fc47203d962319f4f9cc5a43d29346f9a /lib/Server
parentbf52f12fd1710df52abd104622ea63cf2c26ff59 (diff)
Config: switch conferer → conftrackHEADmain
conftrack is a configuration library that I wrote to replace conferer, as dealing with its idiosyncrasies became increasingly annoying. It is currently very much still alpha-state software, but far enough along to be tested in my own projects, and hopefully will soon be in a state that is publishable on hackage. For now, it can be found at https://stuebinm.eu/git/conftrack
Diffstat (limited to 'lib/Server')
-rw-r--r--lib/Server/Frontend/Routes.hs17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/Server/Frontend/Routes.hs b/lib/Server/Frontend/Routes.hs
index 18cf0a1..9245e6a 100644
--- a/lib/Server/Frontend/Routes.hs
+++ b/lib/Server/Frontend/Routes.hs
@@ -69,11 +69,12 @@ instance Yesod Frontend where
isAuthorized OnboardTrackerR _ = pure Authorized
isAuthorized (AuthR _) _ = pure Authorized
isAuthorized _ _ = do
- UffdConfig{..} <- getYesod <&> serverConfigLogin . getSettings
- if uffdConfigEnable then maybeAuthId >>= \case
- Just _ -> pure Authorized
- Nothing -> pure AuthenticationRequired
- else pure Authorized
+ maybeUffd <- getYesod <&> serverConfigLogin . getSettings
+ case maybeUffd of
+ Nothing -> pure Authorized
+ Just UffdConfig{..} -> maybeAuthId >>= \case
+ Just _ -> pure Authorized
+ Nothing -> pure AuthenticationRequired
defaultLayout w = do
@@ -118,9 +119,9 @@ instance YesodAuth Frontend where
type AuthId Frontend = UffdUser
authPlugins cr = case config of
- UffdConfig {..} -> if uffdConfigEnable
- then [ uffdClient uffdConfigUrl uffdConfigClientName uffdConfigClientSecret ]
- else []
+ Just UffdConfig {..} ->
+ [ uffdClient uffdConfigUrl uffdConfigClientName uffdConfigClientSecret ]
+ Nothing -> []
where config = serverConfigLogin (getSettings cr)
maybeAuthId = do