Permalink
Browse files

fix VerifyValues postArgs construction

  • Loading branch information...
1 parent 824fab5 commit 7ed9da3820e0d0b98d8db23b345bb67ae81a2aa7 @brianolson brianolson committed Sep 11, 2011
Showing with 8 additions and 2 deletions.
  1. +6 −2 verify.go
  2. +2 −0 yadis_test.go
View
@@ -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
}
View
@@ -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?

0 comments on commit 7ed9da3

Please sign in to comment.