forked from brianolson/go-openid
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Florian Duraffourg
committed
Aug 19, 2010
1 parent
3545068
commit 48d97e5
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Go-OpenID | ||
========= | ||
|
||
About | ||
----- | ||
|
||
Go-OpenID is an attempt to implement OpenID in Golang. | ||
|
||
Usage | ||
----- | ||
|
||
var o = new(openid.OpenID) | ||
o.Identifier = "https://www.google.com/accounts/o8/id" | ||
o.Realm = "http://example.com" | ||
o.ReturnTo = "/loginCheck" | ||
url := o.GetUrl() | ||
|
||
Now you have to redirect the user to the url returned. The OP will then forward the user back to you. To check the identity, do that: | ||
|
||
var o = new(openid.OpenID) | ||
o.ParseRPUrl(URL) | ||
grant, err := o.Verify() | ||
|
||
grant is true if the user is authenticated, false otherwise. URL must contain the encoded content provided by the OP. | ||
|
||
Once o.ParseRPUrl(URL) is executed, all the information provided by the OP are in the map o.Params. For instance you get the identity with: | ||
|
||
o.Params["openid.claimed_id"] | ||
|