storages

package
Version: v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuntDBStorage

type BuntDBStorage struct {
	BuntDBStorageConfig
	// contains filtered or unexported fields
}

BuntDBStorage is a token storage which uses BuntDB library. It must implement Auth interface (defined in grpc-proto-files). Methods implementing it should retreive only grpc errors

func NewBuntDBStorage

func NewBuntDBStorage(config BuntDBStorageConfig) (storage *BuntDBStorage, err error)

NewBuntDBStorage initializes and returns token storage

func (*BuntDBStorage) AccessTokenByID

func (s *BuntDBStorage) AccessTokenByID(ctx context.Context, req *authProto.AccessTokenByIDRequest) (*authProto.AccessTokenByIDResponse, error)

AccessTokenByID returns user access token

func (*BuntDBStorage) CheckToken

func (s *BuntDBStorage) CheckToken(ctx context.Context, req *authProto.CheckTokenRequest) (*authProto.CheckTokenResponse, error)

CheckToken checks user token. Only access token may be checked. errInvalidToken will be returned if token expired, cannot be parsed or it is not access token errTokenNotOwnedBySender returned if user IP or fingerprint not matches with recorded at token creation.

func (*BuntDBStorage) Close

func (s *BuntDBStorage) Close() error

Close implements closer interface

func (*BuntDBStorage) CreateToken

func (s *BuntDBStorage) CreateToken(ctx context.Context, req *authProto.CreateTokenRequest) (*authProto.CreateTokenResponse, error)

CreateToken creates token with parameters given in req.

func (*BuntDBStorage) DeleteToken

func (s *BuntDBStorage) DeleteToken(ctx context.Context, req *authProto.DeleteTokenRequest) (*empty.Empty, error)

DeleteToken deletes token for user. ErrTokenNotOwnerBySender returned if token owner id not matches id in request

func (*BuntDBStorage) DeleteUserTokens

func (s *BuntDBStorage) DeleteUserTokens(ctx context.Context, req *authProto.DeleteUserTokensRequest) (*empty.Empty, error)

DeleteUserTokens deletes all user tokens

func (*BuntDBStorage) ExtendToken

func (s *BuntDBStorage) ExtendToken(ctx context.Context, req *authProto.ExtendTokenRequest) (*authProto.ExtendTokenResponse, error)

ExtendToken exchanges valid refresh token to new access and refresh tokens.

func (*BuntDBStorage) GetUserTokens

func (s *BuntDBStorage) GetUserTokens(ctx context.Context, req *authProto.GetUserTokensRequest) (*authProto.GetUserTokensResponse, error)

GetUserTokens returns meta information (token id, user agent, user IP) for user

func (*BuntDBStorage) UpdateAccess

func (s *BuntDBStorage) UpdateAccess(ctx context.Context, req *authProto.UpdateAccessRequest) (*empty.Empty, error)

UpdateAccess updates resources accesses for user.

type BuntDBStorageConfig

type BuntDBStorageConfig struct {
	File         string
	BuntDBConfig buntdb.Config
	TokenFactory token.IssuerValidator
}

BuntDBStorageConfig is a configuration for token storage

Source Files

Jump to

Keyboard shortcuts

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