osin_mgo_storage

package
v0.0.0-...-20e2382 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2015 License: MIT Imports: 5 Imported by: 0

README

osin-mongo-storage

mongo storage for OAuth2 go osin server

This package implements the storage interface for OSIN with MongoDB using mgo. It's similar to this implementation Osin storage but work with the latest changes of Osin (client was implemented as interface instead of struct).

##How to use Just initialize it with mgo session and mongo dbname and use it like the default osin storage.

Documentation

Overview

this is storage for oath modules

Index

Constants

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

some collection name

View Source
const REFRESHTOKEN = "refreshtoken"

Variables

This section is empty.

Functions

This section is empty.

Types

type OAuthStorage

type OAuthStorage struct {
	Session *mgo.Session
	// contains filtered or unexported fields
}

keep session to mgo

func NewOAuthStorage

func NewOAuthStorage(session *mgo.Session, dbName string) *OAuthStorage

initialize new storage -- should put global mgo session into

func (*OAuthStorage) Clone

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

renew new storage with cloned session

func (*OAuthStorage) Close

func (s *OAuthStorage) Close()

close the session

func (*OAuthStorage) GetClient

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

func (*OAuthStorage) LoadAccess

func (s *OAuthStorage) LoadAccess(token string) (*osin.AccessData, error)

func (*OAuthStorage) LoadAuthorize

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

func (*OAuthStorage) LoadRefresh

func (s *OAuthStorage) LoadRefresh(token string) (*osin.AccessData, error)

loading access data based on refresh token instead

func (*OAuthStorage) RemoveAccess

func (s *OAuthStorage) RemoveAccess(token string) error

func (*OAuthStorage) RemoveAuthorize

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

func (*OAuthStorage) RemoveRefresh

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

func (*OAuthStorage) SaveAccess

func (s *OAuthStorage) SaveAccess(data *osin.AccessData) error

func (*OAuthStorage) SaveAuthorize

func (s *OAuthStorage) SaveAuthorize(data *osin.AuthorizeData) error

func (*OAuthStorage) SetClient

func (s *OAuthStorage) 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