packages feed

yesod-auth-lti13 0.1.1.0 → 0.1.2.0

raw patch · 4 files changed

+28/−6 lines, 4 files

Files

CHANGELOG.md view
@@ -8,3 +8,7 @@  * Handle Canvas Cloud setting all their issuers the same. * Remove dependency on changed jose-jwt. Thanks @tekul for the help on this.++## 0.1.2.0 -- 2020-09-16++* Add `authLTI13WithWidget`
example/Main.hs view
@@ -44,6 +44,9 @@     loginDest _ = RootR     logoutDest _ = RootR +    onLogout = do+        $logDebug . T.pack . show =<< getSession+     -- Disable any attempt to read persisted authenticated state     maybeAuthId = return Nothing @@ -78,6 +81,10 @@         <h1>Yesod Auth LTI1.3 Example         <h2>Credentials +        <p><a href=@{AuthR LoginR}>Login page</a>+        <!-- XXX: logout doesn't work. It works in real apps, I promise! -->+        <!--<p><a href=@{AuthR LogoutR}>Logout</a>-->+         <h3>Plugin / Ident         <p>#{show mCredsPlugin} / #{show mCredsIdent} @@ -132,8 +139,13 @@ mkFoundation = do     loadEnv     appHttpManager <- newManager tlsManagerSettings-    appAuthPlugins <- return $ [ authLTI13 ]+    appAuthPlugins <- return $ [ authLTI13WithWidget login ]     return App {..}+    where+        login _ = [whamlet|+            <p><a href="https://lti-ri.imsglobal.org/platforms/1255/resource_links">+                Start your login via the LTI reference implementation</a>+        |]  main :: IO () main = runEnv 3000 =<< toWaiApp =<< mkFoundation
src/Yesod/Auth/LTI13.hs view
@@ -23,6 +23,7 @@     , ClientId     , Nonce     , authLTI13+    , authLTI13WithWidget     , YesodAuthLTI13(..)     , getLtiIss     , getLtiSub@@ -34,7 +35,7 @@     ) where  import Yesod.Core.Widget-import Yesod.Auth (Route(PluginR), setCredsRedirect, Creds(..), authHttpManager, AuthHandler, AuthPlugin(..), YesodAuth)+import Yesod.Auth (Auth, Route(PluginR), setCredsRedirect, Creds(..), authHttpManager, AuthHandler, AuthPlugin(..), YesodAuth) import Web.LTI13 import qualified Data.Aeson as A import Data.Text (Text)@@ -318,9 +319,14 @@  -- | Auth plugin. Add this to @appAuthPlugins@ to enable this plugin. authLTI13 :: YesodAuthLTI13 m => AuthPlugin m-authLTI13 = do+authLTI13 = authLTI13WithWidget login+    where+        login _ = [whamlet|<p>Go to your Learning Management System to log in via LTI 1.3|]++-- | Auth plugin. The same as 'authLTI13' but you can provide your own template+--   for the login hint page.+authLTI13WithWidget :: YesodAuthLTI13 m => ((Route Auth -> Route m) -> WidgetFor m ()) -> AuthPlugin m+authLTI13WithWidget login = do     AuthPlugin name (dispatchAuthRequest name) login     where         name = "lti13"-        login _ = [whamlet|Login via your Learning Management System|]-
yesod-auth-lti13.cabal view
@@ -1,7 +1,7 @@ cabal-version:       >=1.10  name:                yesod-auth-lti13-version:             0.1.1.0+version:             0.1.2.0 synopsis:            A yesod-auth plugin for LTI 1.3 description:         A plugin using <https://hackage.haskell.org/package/lti13>                      to implement IMS Global LTI 1.3 authentication for