diff options
| author | LLLL Colonq <llll@colonq> | 2025-06-01 20:34:37 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2025-06-01 20:34:37 -0400 |
| commit | 83cbb69e40fc68606b03b26d70d0a6a0d153fda6 (patch) | |
| tree | 5ef9f91e61b04c56e1176cc68513dc8f82d965d2 /fig-web/src/Fig/Web/Auth.hs | |
| parent | 0dbae80f019d0d84da269286da2cf9bfab7c6141 (diff) | |
fig-web: Support --sim-auth
Diffstat (limited to 'fig-web/src/Fig/Web/Auth.hs')
| -rw-r--r-- | fig-web/src/Fig/Web/Auth.hs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fig-web/src/Fig/Web/Auth.hs b/fig-web/src/Fig/Web/Auth.hs index 5017b3e..0e372c8 100644 --- a/fig-web/src/Fig/Web/Auth.hs +++ b/fig-web/src/Fig/Web/Auth.hs @@ -5,6 +5,7 @@ module Fig.Web.Auth import Fig.Prelude +import qualified Data.Text as Text import qualified Web.Scotty as Sc import Fig.Web.Types @@ -12,14 +13,17 @@ import Fig.Web.Utils data Credentials = Credentials { user :: Text - , email :: Text + , twitchId :: Text } authed :: SecureModuleArgs -> (Credentials -> Sc.ActionM ()) -> Sc.ActionM () -authed args h = do +authed args h | args.options.simAuth = do + let auth = Credentials { user = "fake_test_user", twitchId = "69" } + h auth +authed _ h = do muser <- header "Remote-User" memail <- header "Remote-Email" case (muser, memail) of - (Just user, Just email) -> do + (Just user, Just email) | twitchId:_ <- Text.splitOn "@" email -> do let auth = Credentials{..} h auth _else -> do |
