_example
correct spelling mistake
.github
Add github action to build/test
integration
Reverting back to explicit import.
.travis.yml
Add Go modules support.
discover_test.go
Accepts multiple values in rel attribute.
discover.go
Moved custom getter dependent function code into OpenID methods.
discovery_cache_test.go
Added proper synchronization to the simple discovery cache.
discovery_cache.go
Added proper synchronization to the simple discovery cache.
fake_getter_test.go
Gofmt.
getter.go
Made http.Client configurable on a per-instance basis.
go.mod
Bump golang.org/x/net from 0.0.0-20190522155817-f3200d17e092 to 0.7.0
go.sum
Bump golang.org/x/net from 0.0.0-20190522155817-f3200d17e092 to 0.7.0
html_discovery_test.go
Add test for self-closing link tag
html_discovery.go
Accepts multiple values in rel attribute.
LICENSE
decidated license file. fixes #12
nonce_store_test.go
Added a convenience function to create simple nonce stores.
nonce_store.go
Add Go modules support.
normalizer_test.go
Fixed XRI Cross-Reference URI detection.
normalizer.go
Fixed XRI Cross-Reference URI detection.
openid.go
Made http.Client configurable on a per-instance basis.
README.md
Add links to a libraries providing database-backed nonce/discovery storage
redirect_test.go
Moved custom getter dependent function code into OpenID methods.
redirect.go
Moved custom getter dependent function code into OpenID methods.
verify_test.go
Moved custom getter dependent function code into OpenID methods.
verify.go
Moved custom getter dependent function code into OpenID methods.
xrds_test.go
OP Identifier Element has priority over Claimed Identifier Element.
xrds.go
OP Identifier Element has priority over Claimed Identifier Element.
yadis_discovery_test.go
rearranged package for easier importing
yadis_discovery.go
Fix discovery of self-closing X-XRDS-Location meta tag

openid.go

This is a consumer (Relying party) implementation of OpenId 2.0, written in Go.

go get -u github.com/yohcop/openid-go

Github

Be awesome! Feel free to clone and use according to the licence. If you make a useful change that can benefit others, send a pull request! This ensures that one version has all the good stuff and doesn't fall behind.

Code example

See _example/ for a simple webserver using the openID implementation. Also, read the comment about the NonceStore towards the top of that file. The example must be run for the openid-go directory, like so:

go run _example/server.go

App Engine

In order to use this on Google App Engine, you need to create an instance with a custom *http.Client provided by urlfetch.

oid := openid.NewOpenID(urlfetch.Client(appengine.NewContext(r)))
oid.RedirectURL(...)
oid.Verify(...)

License

Distributed under the Apache v2.0 license.

Libraries

Here is a set of libraries I found on GitHub that could make using this library easier depending on your backends. I haven't tested them, this list is for reference only, and in no particular order:

  • Gacnt/myopenid "A Yohcop-Openid Nonce/Discovery storage replacement", using MySQL.
  • Gacnt/sqlxid "An SQLX Adapter for Nonce / Discovery Cache store"
  • Gacnt/gormid "Use GORM (Go Object Relational Mapping) to store OpenID DiscoveryCache / Nonce in a database"
  • hectorj/mysqlOpenID "MySQL OpenID is a package to replace the in memory storage of discoveryCache and nonceStore."