Skip to content

Commit

Permalink
Small usage explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Duraffourg committed Aug 19, 2010
1 parent 3545068 commit 48d97e5
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.markdown
@@ -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"]

0 comments on commit 48d97e5

Please sign in to comment.