hoauth2-tutorial 0.8.0 → 0.9.0
raw patch · 3 files changed
+22/−22 lines, 3 filesdep ~hoauth2dep ~uri-bytestring
Dependency ranges changed: hoauth2, uri-bytestring
Files
- hoauth2-tutorial.cabal +11/−11
- src/HOAuth2ExperimentTutorial.hs +6/−6
- src/HOAuth2Tutorial.hs +5/−5
hoauth2-tutorial.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: hoauth2-tutorial-version: 0.8.0+version: 0.9.0 synopsis: Tutorial for using hoauth2 description: Tutorial to demostrate how to use hoauth2 to implement OAuth2 flow in an web Application.@@ -23,16 +23,16 @@ common common hs-source-dirs: src build-depends:- , aeson >=2.0 && <2.3- , base >=4.11 && <5- , bytestring >=0.9 && <0.13- , hoauth2 >=2.9 && <2.15- , http-conduit >=2.1 && <2.4- , http-types >=0.11 && <0.13- , scotty >=0.10 && <0.13- , text >=2.0 && <2.3- , transformers >=0.4 && <0.7- , uri-bytestring >=0.2.3 && <0.4+ , aeson >=2.0 && <2.3+ , base >=4.11 && <5+ , bytestring >=0.9 && <0.13+ , hoauth2 >=2.9 && <2.16+ , http-conduit >=2.1 && <2.4+ , http-types >=0.11 && <0.13+ , scotty >=0.10 && <0.13+ , text >=2.0 && <2.3+ , transformers >=0.4 && <0.7+ , uri-bytestring >=0.4 && <0.5 default-language: Haskell2010 ghc-options:
src/HOAuth2ExperimentTutorial.hs view
@@ -128,9 +128,9 @@ import GHC.Generics (Generic) import Network.HTTP.Conduit (newManager, tlsManagerSettings) import Network.HTTP.Types (status302)-import Network.OAuth.OAuth2 (+import Network.OAuth2 ( ExchangeToken (ExchangeToken),- OAuth2Token (accessToken),+ TokenResponse (accessToken), TokenResponseError, ) import Network.OAuth2.Experiment@@ -163,7 +163,7 @@ , acRedirectUri = [uri|http://localhost:9988/oauth2/callback|] , acName = "sample-auth0-authorization-code-app" , acAuthorizeRequestExtraParams = Map.empty- , acTokenRequestAuthenticationMethod = ClientSecretBasic+ , acClientAuthenticationMethod = ClientSecretBasic } auth0DemoApp :: IdpApplication "auth0" AuthorizationCodeApplication@@ -282,9 +282,9 @@ [Scotty.Param] -> Either TL.Text TL.Text paramValue key params =- if null val- then Left ("No value found for param: " <> key)- else Right (head val)+ case val of+ [] -> Left ("No value found for param: " <> key)+ (x : _) -> Right x where val = snd <$> filter (hasParam key) params hasParam :: TL.Text -> Scotty.Param -> Bool
src/HOAuth2Tutorial.hs view
@@ -117,10 +117,10 @@ import GHC.Generics (Generic) import Network.HTTP.Conduit (newManager, tlsManagerSettings) import Network.HTTP.Types (status302)-import Network.OAuth.OAuth2 (+import Network.OAuth2 ( ExchangeToken (ExchangeToken), OAuth2 (..),- OAuth2Token (accessToken),+ TokenResponse (accessToken), TokenResponseError, appendQueryParams, authGetJSON,@@ -271,9 +271,9 @@ [Scotty.Param] -> Either TL.Text TL.Text paramValue key params =- if null val- then Left ("No value found for param: " <> key)- else Right (head val)+ case val of+ [] -> Left ("No value found for param: " <> key)+ (x : _) -> Right x where val = snd <$> filter (hasParam key) params hasParam :: TL.Text -> Scotty.Param -> Bool