persona: github.com/sauerbraten/persona Index | Files | Directories

package persona

import "github.com/sauerbraten/persona"

Package persona offers functionality to use Mozilla's Persona (formerly BrowserID) identification system with Go web applications.

Index

Package Files

persona.go

type Response

type Response struct {
    Status string `json:"status"` // either "okay" or "failure"

    // fields are only populated if status == "failure"
    Reason string `json:"reason,omitempty"` // reason for failure

    // fields are only populated if status == "okay"
    Email    string `json:"email,omitempty"`    // the user's email address
    Audience string `json:"audience,omitempty"` // the audience for which the assertion was verified
    Expires  int64  `json:"expires,omitempty"`  // the expiration date as a unix timestamp
    Issuer   string `json:"issuer,omitempty"`   // the hostname and port of the identity provider
}

Describes a verification response, i.e. the reponse you get when using the https://verifier.login.persona.org/verify service.

func VerifyAssertion

func VerifyAssertion(audience, assertion string) (resp Response, err error)

Verifies an assertion for a given audience. Returns the response and any errors that occured while requesting, receiving and unmarshaling the response. Verification errors have to be handled using Reponse.OK() / Reponse.Status and Response.Reason.

func (Response) OK

func (r Response) OK() bool

Returns true if the verification was successful, and false otherwise.

Directories

PathSynopsis
example

Package persona imports 4 packages (graph) and is imported by 1 packages. Updated 2014-01-30. Refresh now. Tools for package owners.