postgres

package
v0.0.0-...-aa4920a Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package postgres is a osin storage implementation for postgres.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

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

Storage implements interface "github.com/RangelReale/osin".Storage and interface "github.com/ory/osin-storage".Storage

func New

func New(db *sql.DB) *Storage

New returns a new postgres storage instance.

func (*Storage) Clone

func (s *Storage) Clone() osin.Storage

Clone the storage if needed. For example, using mgo, you can clone the session with session.Clone to avoid concurrent access problems. This is to avoid cloning the connection at each method access. Can return itself if not a problem.

func (*Storage) Close

func (s *Storage) Close()

Close the resources the Storage potentially holds (using Clone for example)

func (*Storage) CreateClient

func (s *Storage) CreateClient(c osin.Client) error

CreateClient stores the client in the database and returns an error, if something went wrong.

func (*Storage) CreateSchemas

func (s *Storage) CreateSchemas() error

CreateSchemas creates the schemata, if they do not exist yet in the database. Returns an error if something went wrong.

func (*Storage) GetClient

func (s *Storage) GetClient(id string) (osin.Client, error)

GetClient loads the client by id

func (*Storage) LoadAccess

func (s *Storage) LoadAccess(code string) (*osin.AccessData, error)

LoadAccess retrieves access data by token. Client information MUST be loaded together. AuthorizeData and AccessData DON'T NEED to be loaded if not easily available. Optionally can return error if expired.

func (*Storage) LoadAuthorize

func (s *Storage) LoadAuthorize(code string) (*osin.AuthorizeData, error)

LoadAuthorize looks up AuthorizeData by a code. Client information MUST be loaded together. Optionally can return error if expired.

func (*Storage) LoadRefresh

func (s *Storage) LoadRefresh(code string) (*osin.AccessData, error)

LoadRefresh retrieves refresh AccessData. Client information MUST be loaded together. AuthorizeData and AccessData DON'T NEED to be loaded if not easily available. Optionally can return error if expired.

func (*Storage) RemoveAccess

func (s *Storage) RemoveAccess(code string) (err error)

RemoveAccess revokes or deletes an AccessData.

func (*Storage) RemoveAuthorize

func (s *Storage) RemoveAuthorize(code string) (err error)

RemoveAuthorize revokes or deletes the authorization code.

func (*Storage) RemoveClient

func (s *Storage) RemoveClient(id string) (err error)

RemoveClient removes a client (identified by id) from the database. Returns an error if something went wrong.

func (*Storage) RemoveRefresh

func (s *Storage) RemoveRefresh(code string) error

RemoveRefresh revokes or deletes refresh AccessData.

func (*Storage) SaveAccess

func (s *Storage) SaveAccess(data *osin.AccessData) (err error)

SaveAccess writes AccessData. If RefreshToken is not blank, it must save in a way that can be loaded using LoadRefresh.

func (*Storage) SaveAuthorize

func (s *Storage) SaveAuthorize(data *osin.AuthorizeData) (err error)

SaveAuthorize saves authorize data.

func (*Storage) UpdateClient

func (s *Storage) UpdateClient(c osin.Client) error

UpdateClient updates the client (identified by it's id) and replaces the values with the values of client.

Jump to

Keyboard shortcuts

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