authrepo

package
v0.0.0-...-fade1fe Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	URI      string
	Username string
	Password string
}

Configuration is settings for mongodb connection

type Repository

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

Repository with users' credentials

func New

func New(ctx context.Context, conf *Configuration) (*Repository, error)

New returns new instance of repository

func (*Repository) ChangeToken

func (r *Repository) ChangeToken(ctx context.Context, guid, oldAccessToken, refreshToken, accessToken string) error

ChangeToken changes token by ids guid

func (*Repository) Close

func (r *Repository) Close(ctx context.Context) error

Close connetction to database

func (*Repository) GetToken

func (r *Repository) GetToken(ctx context.Context, guid, accessToken string) (*token.Token, error)

GetToken returns whole token by refresh and access token

func (*Repository) RemoveAllTokens

func (r *Repository) RemoveAllTokens(ctx context.Context, guid string) error

RemoveAllTokens remove all user's tokens by guid

func (*Repository) RemoveToken

func (r *Repository) RemoveToken(ctx context.Context, guid, accessToken string) error

RemoveToken removes user's token by guid and access token

func (*Repository) SaveToken

func (r *Repository) SaveToken(ctx context.Context, tkn *token.Token) error

SaveToken saves user's refresh token and its guid in auth collecton

Jump to

Keyboard shortcuts

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