kvstore

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: UPL-1.0 Imports: 13 Imported by: 0

Documentation

Overview

Package kvstore provides authorization provider implementations for clients that connect to on-premise NoSQL servers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessTokenProvider

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

AccessTokenProvider is an access token provider used for on-premise NoSQL server.

This implements the nosqldb.AuthorizationProvider interface.

func NewAccessTokenProvider

func NewAccessTokenProvider(username string, password []byte, options ...auth.ProviderOptions) (*AccessTokenProvider, error)

NewAccessTokenProvider creates an access token provider with the specified username, password and options.

This is a variadic function that may be invoked with zero or more arguments for the options parameter, but only the first argument for the options parameter, if specified, is used, others are ignored.

This is used for the NoSQL server that is enabled with security configurations.

func NewAccessTokenProviderFromFile

func NewAccessTokenProviderFromFile(configFile string, options ...auth.ProviderOptions) (*AccessTokenProvider, error)

NewAccessTokenProviderFromFile creates an access token provider using the specified configuration file and options. The configuration file must specify the username and password that used to authenticate with the Oracle NoSQL Server in the form of:

username=user1
password=NoSql00__123456

This is a variadic function that may be invoked with zero or more arguments for the options parameter, but only the first argument for the options parameter, if specified, is used, others are ignored.

This is used for the NoSQL server that is enabled with security configurations.

func (*AccessTokenProvider) AuthorizationScheme

func (p *AccessTokenProvider) AuthorizationScheme() string

AuthorizationScheme returns "Bearer" for this provider which means the bearer who holds the access token can access authorized resources.

func (*AccessTokenProvider) AuthorizationString

func (p *AccessTokenProvider) AuthorizationString(req auth.Request) (auth string, err error)

AuthorizationString returns an authorization string used for the specified request, which is in the form of:

Bearer <access_token>

This method looks for the access token from local cache, if found, returns the token, otherwise acquires the access token from remote authorization server.

If the token retrieved from cache is valid, and is about to expire in a duration of time that is within the specified expiry window, this method starts a new goroutine to renew the token and refresh the cache.

A cached token may not get a chance to renew if it is not retrieved by the provider within the expiry window, which means it is not recently used.

func (*AccessTokenProvider) Close

func (p *AccessTokenProvider) Close() error

Close releases resources allocated by the provider and sets closed state for the provider.

func (*AccessTokenProvider) GetHTTPClient

func (p *AccessTokenProvider) GetHTTPClient() *httputil.HTTPClient

GetHTTPClient returns the http client associated with the provider.

func (*AccessTokenProvider) SetEndpoint

func (p *AccessTokenProvider) SetEndpoint(endpoint string) *AccessTokenProvider

SetEndpoint sets the specified authorization server endpoint for the provider.

This method is exported for use by the nosqldb.Client. Applications should not use this method.

func (*AccessTokenProvider) SetHTTPClient

func (p *AccessTokenProvider) SetHTTPClient(httpClient *httputil.HTTPClient) *AccessTokenProvider

SetHTTPClient sets the specified http client for the provider.

func (*AccessTokenProvider) SignHTTPRequest

func (p *AccessTokenProvider) SignHTTPRequest(req *http.Request) error

SignHTTPRequest is unused in kvstore on-prem logic

Jump to

Keyboard shortcuts

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