From 7ed9da3820e0d0b98d8db23b345bb67ae81a2aa7 Mon Sep 17 00:00:00 2001 From: Brian Olson Date: Sun, 11 Sep 2011 16:27:47 -0400 Subject: [PATCH] fix VerifyValues postArgs construction --- verify.go | 8 ++++++-- yadis_test.go | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/verify.go b/verify.go index 5cdb41e..5e0f078 100644 --- a/verify.go +++ b/verify.go @@ -59,8 +59,6 @@ func VerifyValues(values url.Values) (grant bool, identifier string, err os.Erro var postArgs url.Values postArgs = url.Values(map[string][]string{}) - //postArgs = new(http.Values) - postArgs.Set("openid.mode", "check_authentication") // Create the url URLEndPoint := values.Get("openid.op_endpoint") @@ -74,6 +72,7 @@ func VerifyValues(values url.Values) (grant bool, identifier string, err os.Erro } postArgs[k] = v } + postArgs.Set("openid.mode", "check_authentication") postContent := postArgs.Encode() // Post the request @@ -85,6 +84,7 @@ func VerifyValues(values url.Values) (grant bool, identifier string, err os.Erro return false, "", err } +/* redirLimit := 3 for (redirLimit > 0) && (response.StatusCode == 301 || response.StatusCode == 302 || response.StatusCode == 303 || response.StatusCode == 307) { location := response.Header.Get("Location") @@ -95,6 +95,7 @@ func VerifyValues(values url.Values) (grant bool, identifier string, err os.Erro return false, "", err } } +*/ // Parse the response // Convert the reader @@ -123,6 +124,9 @@ func VerifyValues(values url.Values) (grant bool, identifier string, err os.Erro } identifier = values.Get("openid.claimed_id") + if !match { + log.Printf("no is_valid:true in \"%s\"", buffer) + } return match, identifier, nil } diff --git a/yadis_test.go b/yadis_test.go index eb1f73d..2db85a2 100644 --- a/yadis_test.go +++ b/yadis_test.go @@ -7,6 +7,8 @@ // curl -o test_data/google_yadis.html --dump-header test_data/google_yadis.http --header "Accept: application/xrds+xml" 'https://www.google.com/accounts/o8/id' // curl -o test_data/orange_yadis.html --dump-header test_data/orange_yadis.http --header "Accept: application/xrds+xml" "http://www.orange.fr/" // curl -o test_data/yahoo_yadis.html --dump-header test_data/yahoo_yadis.http --header "Accept: application/xrds+xml" "http://www.yahoo.com/" +// curl -o test_data/orange_xrds.html --dump-header test_data/orange_xrds.http --header "Accept: application/xrds+xml" "http://openid.orange.fr/xrds" +// curl -o test_data/yahoo_xrds.html --dump-header test_data/yahoo_xrds.http --header "Accept: application/xrds+xml" "http://open.login.yahooapis.com/openid20/www.yahoo.com/xrds" // TODO: facebook? livejournal?