This is a Go package providing easy access to the Persona verification API.
Get the package:
$ go get github.com/sauerbraten/persona
Import the package:
import (
"github.com/sauerbraten/persona"
)
Using persona works like this:
- you write your own sign in handler
- your sign in handler calls
persona.VerifyAssertion()
and passes your site's audience and the assertion you received with the sign in request from your site's javascript persona.VerifyAssertion()
returns a persona.Response- based on this response and on
persona.Response.OK()
, you either set a session cookie for access to your site or return an error, which should make your site's javascript callnavigator.id.logout()
There is an example implementation in example/. Run go run *.go
in that directory to get a demo site running at localhost:8080.
Full documentation is at http://godoc.org/github.com/sauerbraten/persona.
This code is licensed under a BSD License:
Copyright (c) 2013 Alexander Willing. All rights reserved.
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.