authenticate 1.3.4 → 1.3.5
raw patch · 3 files changed
+22/−20 lines, 3 filesdep +html-conduitdep −tagstream-conduitdep ~http-conduitPVP ok
version bump matches the API change (PVP)
Dependencies added: html-conduit
Dependencies removed: tagstream-conduit
Dependency ranges changed: http-conduit
API changes (from Hackage documentation)
Files
- ChangeLog.md +6/−0
- OpenId2/Discovery.hs +14/−18
- authenticate.cabal +2/−2
ChangeLog.md view
@@ -1,3 +1,9 @@+# authenticate changelog++## 1.3.5++* Drop tagstream-conduit dep (for GHC 8.8 support)+ ## 1.3.4 * Relaxed a bunch of type signatures
OpenId2/Discovery.hs view
@@ -30,7 +30,7 @@ import qualified Data.ByteString.Char8 as S8 import Control.Arrow (first) import Control.Monad.IO.Class (MonadIO (liftIO))-import Control.Monad (mplus, liftM)+import Control.Monad (mplus, liftM, guard) import qualified Data.CaseInsensitive as CI import Data.Text (Text, unpack) import Data.Text.Lazy (toStrict)@@ -40,10 +40,10 @@ import Control.Applicative ((<$>), (<*>)) import Network.HTTP.Types (status200) import Control.Exception (throwIO)-import Data.Conduit ((=$), ($$), yield)-import Text.HTML.TagStream.Text (tokenStream, Token)-import Text.HTML.TagStream.Types (Token' (TagOpen))-import qualified Data.Conduit.List as CL+import Text.HTML.DOM+import Text.XML.Cursor+import Text.XML (Node (..), Element (..))+import qualified Data.Map as Map data Discovery = Discovery1 Text (Maybe Text) | Discovery2 Provider Identifier IdentType@@ -149,15 +149,17 @@ -- document. parseHTML :: Identifier -> Text -> Maybe Discovery parseHTML ident text0 = do- ls <- yield text0- $$ tokenStream- =$ CL.mapMaybe linkTag- =$ CL.filter isOpenId- =$ CL.consume+ let doc = parseSTChunks [text0]+ cursor = fromDocument doc+ links = map node $ cursor $// element "link"+ ls = do+ NodeElement (Element "link" as _) <- links+ Just rel <- pure $ Map.lookup "rel" as+ Just href <- pure $ Map.lookup "href" as+ guard $ "openid" `T.isPrefixOf` rel+ pure (rel, href) resolve ls where- isOpenId (rel, _x) = "openid" `T.isPrefixOf` rel- resolve1 ls = do server <- lookup "openid.server" ls let delegate = lookup "openid.delegate" ls@@ -170,9 +172,3 @@ return $ Discovery2 (Provider prov) lid ClaimedIdent resolve ls = resolve2 ls `mplus` resolve1 ls----- | Filter out link tags from a list of html tags.-linkTag :: Token -> Maybe (Text, Text)-linkTag (TagOpen "link" as _) = (,) <$> lookup "rel" as <*> lookup "href" as-linkTag _x = Nothing
authenticate.cabal view
@@ -1,5 +1,5 @@ name: authenticate-version: 1.3.4+version: 1.3.5 license: MIT license-file: LICENSE author: Michael Snoyman, Hiromi Ishii, Arash Rouhani@@ -32,7 +32,7 @@ , containers , unordered-containers , conduit >= 0.5- , tagstream-conduit >= 0.5.5+ , html-conduit >= 1.3 , resourcet exposed-modules: Web.Authenticate.Rpxnow, Web.Authenticate.OpenId,