tokenserver

package
v0.0.0-...-cdfbe92 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2014 License: MPL-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DEFAULT_PERSONA_VERIFIER   = "https://verifier.accounts.firefox.com/v2"
	DEFAULT_PERSONA_AUDIENCE   = "http://127.0.0.1"
	DEFAULT_ALLOW_NEW_USERS    = true
	DEFAULT_TOKEN_DURATION     = 300
	DEFAULT_SHARED_SECRET      = "ThisIsAnImportantSecretThatYouShouldChange"
	DEFAULT_STORAGESERVER_NODE = "http://127.0.0.1:8124/storage"
	DEFAULT_DATABASE_PATH      = "/tmp/tokenserver.db"
)

Variables

This section is empty.

Functions

func SetupRouter

func SetupRouter(r *mux.Router, config Config) (*tokenServerContext, error)

Types

type Config

type Config struct {
	PersonaVerifier   string
	PersonaAudience   string
	AllowNewUsers     bool
	TokenDuration     int64
	SharedSecret      string
	StorageServerNode string
	DatabasePath      string
}

func DefaultConfig

func DefaultConfig() Config

type DatabaseSession

type DatabaseSession struct {
	// contains filtered or unexported fields
}

func NewDatabaseSession

func NewDatabaseSession(path string) (*DatabaseSession, error)

func (*DatabaseSession) AllocateUser

func (ds *DatabaseSession) AllocateUser(email string, generation uint64, clientState string) (*User, error)

func (*DatabaseSession) Close

func (session *DatabaseSession) Close()

func (*DatabaseSession) GetUser

func (ds *DatabaseSession) GetUser(email string) (*User, error)

func (*DatabaseSession) UpdateUser

func (ds *DatabaseSession) UpdateUser(email string, newGeneration uint64, newClientState string) (*User, error)

type TokenServerResponse

type TokenServerResponse struct {
	Id          string `json:"id"`           // Signed authorization token
	Key         string `json:"key"`          // Secret derived from the shared secret
	Uid         uint64 `json:"uid"`          // The user id for this service
	ApiEndpoint string `json:"api_endpoint"` // The root URL for the user of this service
	Duration    int64  `json:"duration"`     // the validity duration of the issued token, in seconds
}

type User

type User struct {
	Uid             uint64
	Email           string
	Generation      uint64
	ClientState     string
	OldClientStates []string
}

func (*User) IsOldClientState

func (u *User) IsOldClientState(clientState string) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL