mgostore

package
v0.0.0-...-36cc0ba Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2018 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const (
	CLIENT_COL    = "clients"
	AUTHORIZE_COL = "authorizations"
	ACCESS_COL    = "accesses"
)

collection names for the entities

View Source
const REFRESHTOKEN = "$hashed:refreshtoken"

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultAccessData

type DefaultAccessData struct {
	// Client information
	Client osin.DefaultClient `bson:'client'`

	// Authorize data, for authorization code
	AuthorizeData *DefaultAuthorizeData `bson:'authorizedata'`

	// Previous access data, for refresh token
	AccessData *DefaultAccessData `bson:'accessdata'`

	// Access token
	AccessToken string `bson:'accesstoken'`

	// Refresh Token. Can be blank
	RefreshToken string `bson:'refreshtoken'`

	// Token expiration in seconds
	ExpiresIn int32 `bson:'expiresin'`

	// Requested scope
	Scope string `bson:'scope'`

	// Redirect Uri from request
	RedirectUri string `bson:'redirecturi'`

	// Date created
	CreatedAt time.Time `bson:'createdat'`

	// Data to be passed to storage. Not used by the library.
	UserData interface{} `bson:'userdata'`
}

AccessData represents an access grant (tokens, expiration, client, etc)

func (*DefaultAccessData) CopyToAccessData

func (defautlAccessData *DefaultAccessData) CopyToAccessData(accessData *osin.AccessData)

type DefaultAuthorizeData

type DefaultAuthorizeData struct {
	// Client information
	Client osin.DefaultClient `bson:'client'`

	// Authorization code
	Code string `bson:'code'`

	// Token expiration in seconds
	ExpiresIn int32 `bson:'expiresin'`

	// Requested scope
	Scope string `bson:'scope'`

	// Redirect Uri from request
	RedirectUri string `bson:'redirecturi'`

	// State data from request
	State string `bson:'state'`

	// Date created
	CreatedAt time.Time `bson:'createdat'`

	// Data to be passed to storage. Not used by the library.
	UserData interface{} `bson:'userdata'`
}

func (*DefaultAuthorizeData) CopyToAuthorizeData

func (defaultAuthorizeData *DefaultAuthorizeData) CopyToAuthorizeData(authorizeData *osin.AuthorizeData)

type MongoStorage

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

func New

func New(session *mgo.Session, dbName string) *MongoStorage

func (*MongoStorage) Clone

func (store *MongoStorage) Clone() osin.Storage

func (*MongoStorage) Close

func (store *MongoStorage) Close()

func (*MongoStorage) GetClient

func (store *MongoStorage) GetClient(id string) (osin.Client, error)

func (*MongoStorage) LoadAccess

func (store *MongoStorage) LoadAccess(token string) (*osin.AccessData, error)

func (*MongoStorage) LoadAuthorize

func (store *MongoStorage) LoadAuthorize(code string) (*osin.AuthorizeData, error)

func (*MongoStorage) LoadRefresh

func (store *MongoStorage) LoadRefresh(token string) (*osin.AccessData, error)

func (*MongoStorage) RemoveAccess

func (store *MongoStorage) RemoveAccess(token string) error

func (*MongoStorage) RemoveAuthorize

func (store *MongoStorage) RemoveAuthorize(code string) error

func (*MongoStorage) RemoveRefresh

func (store *MongoStorage) RemoveRefresh(token string) error

func (*MongoStorage) SaveAccess

func (store *MongoStorage) SaveAccess(data *osin.AccessData) error

func (*MongoStorage) SaveAuthorize

func (store *MongoStorage) SaveAuthorize(data *osin.AuthorizeData) error

func (*MongoStorage) SetClient

func (store *MongoStorage) SetClient(id string, client osin.Client) error

Jump to

Keyboard shortcuts

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