mongodb

package
v0.0.0-...-2496799 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store implements ClientRepository and AuthCodeRepository storing data in MongoDB collections.

func New

func New(url string, dbName string) (*Store, error)

New creates a new Store which has implementations for all the repositories required by the Authorization Server.

func (*Store) CheckAuthorizationCodeByID

func (m *Store) CheckAuthorizationCodeByID(ctx context.Context, tokenID string) (bool, error)

CheckAuthorizationCodeByID checks if the given tokenID is stored as used in the persistence. If so, it returns true.

func (*Store) DeleteClient

func (m *Store) DeleteClient(ctx context.Context, client *model.Client) error

DeleteClient removes the given client from the persistence. It should not fail if the client was already removed.

func (*Store) DeleteClientByID

func (m *Store) DeleteClientByID(ctx context.Context, clientID string) error

DeleteClientByID removes the client with the given ID from the persistence. It should not fail if the client was already removed.

func (*Store) GetAllClientsByOwner

func (m *Store) GetAllClientsByOwner(ctx context.Context, owner string) ([]*model.Client, error)

GetAllClientsByOwner obtains all the clients from the persistence which owner is the given user. If there aren'y any clients owned by that user, an empty slice is returned.

func (*Store) GetClientByID

func (m *Store) GetClientByID(ctx context.Context, clientID string) (*model.Client, error)

GetClientByID obtains a client from the persistence with the given clientID. If there isn't a client with the provided ID, (nil, nil) is returned.

func (*Store) StoreClient

func (m *Store) StoreClient(ctx context.Context, client *model.Client) (*model.Client, error)

StoreClient stores a client in the persistence. If a client with the same clientID already exists, it's overwritten. If something goes wrong an error is returned.

func (*Store) StoreUsedAuthorizationCode

func (m *Store) StoreUsedAuthorizationCode(ctx context.Context, code *model.OAuthAuthorizationCode) error

StoreUsedAuthorizationCode stores a used authorization code in the storage. It should not fail if the code is already stored.

Jump to

Keyboard shortcuts

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