Giter Site home page Giter Site logo

authenticate's People

Contributors

ahodgen avatar dbpatterson avatar felixonmars avatar gregwebs avatar himura avatar konn avatar mageshb avatar meteficha avatar michaelxavier avatar mlitchard avatar nomeata avatar qzchenwl avatar rbtcollins avatar rianhunter avatar snoyberg avatar tarrasch avatar vekhir avatar vshabanov avatar ysangkok avatar zudov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

authenticate's Issues

OpenID Steam

Hello, i'm getting Handshake Errors (presumably from TLS) when calling authenticate (getForwardUrl works fine apparently).

Below is code so you can reproduce, unfortunately this will require creating an account with the OpenID provider in question.

{-# LANGUAGE OverloadedStrings #-}

import qualified Data.Text.Encoding as T
import qualified Data.Text.Lazy as LT
import qualified Data.Text.Lazy.Encoding as LT

import Network.HTTP.Types
import Network.HTTP.Conduit (newManager)

import Network.Wai
import Network.Wai.Handler.Warp

import Web.Authenticate.OpenId

main = run 3000 $ \req -> do
  man <- newManager
  case pathInfo req of
    [] -> do
      url <- getForwardUrl "http://steamcommunity.com/openid" "http://localhost:3000/check"
                           Nothing [] man
      return $ responseLBS statusFound [("Location", T.encodeUtf8 url)] ""
    ["check"] -> do
      let query = map (\(k,v) -> (T.decodeUtf8 k, T.decodeUtf8 v))
                      (parseSimpleQuery $ rawQueryString req)
      id <- fmap (identifier . fst) $ authenticate query man
      return $ responseLBS statusOK [] . LT.encodeUtf8 . LT.fromChunks . (:[]) $ id
    _ -> return $ responseLBS statusNotFound [] ""

port to http-client

hi,

i'd like to port it to http-client and remove the conduit dependency.

i would just use IO instead of MonadResource, MonadUnsafeIO, etc. what do you think?

(i have a proof of concept with MonadIO as well.)

Please implement BrowserID assertion verification directly, without using browserid.org/verify

Currently, checkAssertion in Web.Authenticate.BrowserID just does a POST to https://browserid.org/verify . Please consider implementing BrowserID assertion verification directly. See https://wiki.mozilla.org/Identity/BrowserID#Assertion_Verification (and the preceding bits on that page) for the specification, and https://github.com/mozilla/browserid/blob/dev/bin/verifier for the source of the reference validator (written with node.js). (For the latter, note that the real work happens in the libraries loaded from https://github.com/mozilla/browserid/tree/dev/lib/verifier .)

authenticate URI and obtaining oauth_token from Credential

Hello,

Most likely I'm missing something, but I think API lacks few helpers.

I'm trying to use it to authenticate via twitter, hence:

oauthTwitter :: OAuth
oauthTwitter = newOAuth
               { oauthServerName = "api.twitter.com"
               , oauthRequestUri      = "https://api.twitter.com/oauth/request_token"
               , oauthAccessTokenUri  = "https://api.twitter.com/oauth/access_token"
               , oauthAuthorizeUri    = "https://api.twitter.com/oauth/authorize"
               , oauthSignatureMethod = HMACSHA1
               , oauthConsumerKey = "<snip>" 
               , oauthConsumerSecret = "<snip!>"
               , oauthVersion         = OAuth10a }

main = do
  mgr <- newManager tlsManagerSettings
  cred <- getTemporaryCredential oauthTwitter mgr
  let token = lookup "oauth_token" $ unCredential cred
  -- and now, use this token to generate api/oauth/authenticate?oauth_token=.... URL for the browser

So, in last two lines I'm doing raw lookup to grab the token, and then raw concatenation to generate URL (I rather use a helper akin to that of authorizeUrl to generate it for me). Am I correct in thinking that something like this could be added to the API?

`getAccessToken` returns extra fields

When trying to use this to authenticate with Twitter using the sample code here https://github.com/himura/twitter-conduit/blob/master/sample/simple.hs it fails.

The problem seems to be that the Credential returned by getAccessToken contains extra fields:

Credential {unCredential = [("oauth_token","XXX"),("oauth_token_secret","YYY"),("user_id","51459324"),("screen_name","nomeata")]}

and using these credentials later fails. I have to remove them using code like this

    let cred' = filter (\(k,v) -> k /= "user_id" && k /= "screen_name") cred

to make it work.

I am not sure if Twitter, authenticate-oauth or twitter-conduit is to blame, but somewhere something goes wrong…

Realted: himura/twitter-conduit#64

Build errors with aeson-2

When I build authenticate-1.3.5 with aeson-2.0.1.0, I get the following errors:

Web/Authenticate/BrowserId.hs:36:35: error:
    • Couldn't match type ‘Data.Aeson.KeyMap.KeyMap Value’
                     with ‘Map.HashMap k0 Value’
      Expected type: Map.HashMap k0 Value
        Actual type: aeson-2.0.1.0:Data.Aeson.Types.Internal.Object
    • In the second argument of ‘Map.lookup’, namely ‘o’
      In the expression: Map.lookup "status" o
      In the expression: (Map.lookup "status" o, Map.lookup "email" o)
   |
36 |         case (Map.lookup "status" o, Map.lookup "email" o) of
   |                                   ^

Web/Authenticate/BrowserId.hs:36:57: error:
    • Couldn't match type ‘Data.Aeson.KeyMap.KeyMap Value’
                     with ‘Map.HashMap k1 Value’
      Expected type: Map.HashMap k1 Value
        Actual type: aeson-2.0.1.0:Data.Aeson.Types.Internal.Object
    • In the second argument of ‘Map.lookup’, namely ‘o’
      In the expression: Map.lookup "email" o
      In the expression: (Map.lookup "status" o, Map.lookup "email" o)
   |
36 |         case (Map.lookup "status" o, Map.lookup "email" o) of
   |                                                         ^

Dependency Hell - Authenticate-oauth 1.3.0.2 and Yesod-Platform 1.0.4.2

There is a DH Problem at the moment when using Yesod Platform
Yesod Platform 1.0.4.2 specifies base64-bytestring (0.1.1.1);
authenticate.oauth specifies base64-bytestring (0.1.*) which picks up base64-bytestring (0.1.2.0), so that the Yesod Platform is rejected
Perhaps it is for Yesod Platform to specify base64-bytestring (0.1.2.0).
I have worked around by removing the dependency on Yesod Platform.

Robert

Please provide a way to self-host the BrowserID JavaScript rather than loading it from browserid.org/include.js

Currently, the BrowserID implementation expects to just add a script tag referencing browserid.org/include.js. Please consider providing an easy way for sites to host that script themselves, to avoid referencing third-party scripts. According to the BrowserID folks, the API between include.js and browserid.org has almost entirely stabilized, though they don't plan to declare it entirely stable until this summer.

Build against conduit 1.1

conduit-1.1 no longer includes Data.Conduit.Blaze - it looks like you need to depend on conduit-extra.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.