File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change 1
1
{-# LANGUAGE OverloadedStrings #-}
2
+ {-# LANGUAGE QuasiQuotes #-}
2
3
3
4
-- |
4
5
--
9
10
module Yesod.Auth.OAuth2.AzureADv2
10
11
( oauth2AzureADv2
11
12
, oauth2AzureADv2Scoped
13
+ , oauth2AzureADv2Widget
14
+ , oauth2AzureADv2ScopedWidget
12
15
) where
13
16
14
17
import Yesod.Auth.OAuth2.Prelude
18
+ import Yesod.Core (WidgetFor , whamlet )
15
19
import Prelude
16
20
17
21
import Data.String
@@ -41,9 +45,20 @@ oauth2AzureADv2
41
45
-> AuthPlugin m
42
46
oauth2AzureADv2 = oauth2AzureADv2Scoped defaultScopes
43
47
44
- oauth2AzureADv2Scoped
48
+ oauth2AzureADv2Widget
49
+ :: YesodAuth m => WidgetFor m () -> Text -> Text -> Text -> AuthPlugin m
50
+ oauth2AzureADv2Widget widget =
51
+ oauth2AzureADv2ScopedWidget widget defaultScopes
52
+
53
+ oauth2AzureADv2Scoped :: YesodAuth m => [Text ] -> Text -> Text -> Text -> AuthPlugin m
54
+ oauth2AzureADv2Scoped =
55
+ oauth2AzureADv2ScopedWidget [whamlet |Login via #{pluginName}|]
56
+
57
+ oauth2AzureADv2ScopedWidget
45
58
:: YesodAuth m
46
- => [Text ]
59
+ => WidgetFor m ()
60
+ -- ^ Widget
61
+ -> [Text ]
47
62
-- ^ Scopes
48
63
-> Text
49
64
-- ^ Tenant Id
@@ -54,8 +69,8 @@ oauth2AzureADv2Scoped
54
69
-> Text
55
70
-- ^ Client Secret
56
71
-> AuthPlugin m
57
- oauth2AzureADv2Scoped scopes tenantId clientId clientSecret =
58
- authOAuth2 pluginName oauth2 $ \ manager token -> do
72
+ oauth2AzureADv2ScopedWidget widget scopes tenantId clientId clientSecret =
73
+ authOAuth2Widget widget pluginName oauth2 $ \ manager token -> do
59
74
(User userId, userResponse) <-
60
75
authGetProfile
61
76
pluginName
You can’t perform that action at this time.
0 commit comments