Skip to content

Commit

Permalink
fix VerifyValues postArgs construction
Browse files Browse the repository at this point in the history
  • Loading branch information
brianolson committed Sep 14, 2011
1 parent 824fab5 commit 7ed9da3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions verify.go
Expand Up @@ -59,8 +59,6 @@ func VerifyValues(values url.Values) (grant bool, identifier string, err os.Erro


var postArgs url.Values var postArgs url.Values
postArgs = url.Values(map[string][]string{}) postArgs = url.Values(map[string][]string{})
//postArgs = new(http.Values)
postArgs.Set("openid.mode", "check_authentication")


// Create the url // Create the url
URLEndPoint := values.Get("openid.op_endpoint") URLEndPoint := values.Get("openid.op_endpoint")
Expand All @@ -74,6 +72,7 @@ func VerifyValues(values url.Values) (grant bool, identifier string, err os.Erro
} }
postArgs[k] = v postArgs[k] = v
} }
postArgs.Set("openid.mode", "check_authentication")
postContent := postArgs.Encode() postContent := postArgs.Encode()


// Post the request // Post the request
Expand All @@ -85,6 +84,7 @@ func VerifyValues(values url.Values) (grant bool, identifier string, err os.Erro
return false, "", err return false, "", err
} }


/*
redirLimit := 3 redirLimit := 3
for (redirLimit > 0) && (response.StatusCode == 301 || response.StatusCode == 302 || response.StatusCode == 303 || response.StatusCode == 307) { for (redirLimit > 0) && (response.StatusCode == 301 || response.StatusCode == 302 || response.StatusCode == 303 || response.StatusCode == 307) {
location := response.Header.Get("Location") location := response.Header.Get("Location")
Expand All @@ -95,6 +95,7 @@ func VerifyValues(values url.Values) (grant bool, identifier string, err os.Erro
return false, "", err return false, "", err
} }
} }
*/


// Parse the response // Parse the response
// Convert the reader // Convert the reader
Expand Down Expand Up @@ -123,6 +124,9 @@ func VerifyValues(values url.Values) (grant bool, identifier string, err os.Erro
} }


identifier = values.Get("openid.claimed_id") identifier = values.Get("openid.claimed_id")
if !match {
log.Printf("no is_valid:true in \"%s\"", buffer)
}


return match, identifier, nil return match, identifier, nil
} }
Expand Down
2 changes: 2 additions & 0 deletions yadis_test.go
Expand Up @@ -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/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/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/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? // TODO: facebook? livejournal?




Expand Down

0 comments on commit 7ed9da3

Please sign in to comment.