models

package
v0.0.0-...-578c946 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2015 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Id          string
	Secret      string
	RedirectUri string
	UserData    interface{}
	Code        string
	ExpiresIn   int32
	State       string
	Created     time.Time
}

func (Client) GetId

func (c Client) GetId() string

func (Client) GetRedirectUri

func (c Client) GetRedirectUri() string

func (Client) GetSecret

func (c Client) GetSecret() string

func (Client) GetUserData

func (c Client) GetUserData() interface{}

func (Client) ToOsinAuthorizeData

func (c Client) ToOsinAuthorizeData() osin.AuthorizeData

type Storage

type Storage struct {
	DB *sql.DB
}

func NewStorage

func NewStorage(db *sql.DB) *Storage

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) GetClient

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

GetClient loads the client by id (client_id)

func (*Storage) LoadAccess

func (s *Storage) LoadAccess(token 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)

func (*Storage) LoadRefresh

func (s *Storage) LoadRefresh(token 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(token string) error

RemoveAccess revokes or deletes an AccessData.

func (*Storage) RemoveAuthorize

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

RemoveAuthorize revokes or deletes the authorization code.

func (*Storage) RemoveRefresh

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

RemoveRefresh revokes or deletes refresh AccessData.

func (*Storage) SaveAccess

func (s *Storage) SaveAccess(*osin.AccessData) 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) error

SaveAuthorize saves authorize data.

Jump to

Keyboard shortcuts

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