openauth

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOpenAuthClientV1 added in v1.0.2

func NewOpenAuthClientV1(ctx context.Context, config *ClientConfig) (openauth_v1.OpenAuthClient, *grpc.ClientConn, error)

Types

type ClientConfig

type ClientConfig struct {
	Endpoint string
	Username string
	Password string
	TLS      bool
	Timeout  time.Duration
}

type ConfigFetcher

type ConfigFetcher interface {
	GetConfigsByKeys(ctx context.Context, in *openauth_v1.GetConfigsByKeysRequest) (*openauth_v1.GetConfigsByKeysResponse, error)
}

type ConfigReader

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

func NewConfigReader

func NewConfigReader(fetcher ConfigFetcher, options ...ReadOptions) *ConfigReader

func NewOpenAuthConfigReader

func NewOpenAuthConfigReader(cfg *ClientConfig, options ...ReadOptions) *ConfigReader

func (*ConfigReader) ReadConfig

func (r *ConfigReader) ReadConfig(ctx context.Context, cfg any) error

reads configuration into the provided cfg structure based on its tags cfg should be a pointer to a struct with appropriate tags Example:

type MyConfig struct {
    Key   string `entity:"openauth" key:"key"`
    Value string `entity:"openauth" key:"value"`
}

myConfig := &MyConfig{} err := configReader.Read(ctx, myConfig) This will populate myConfig.Key and myConfig.Value with the corresponding config values

type OpenauthConfigFetcher added in v1.0.2

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

func NewOpenauthConfigFetcher added in v1.0.2

func NewOpenauthConfigFetcher(ctx context.Context, config *ClientConfig) (*OpenauthConfigFetcher, error)

func (*OpenauthConfigFetcher) Close added in v1.0.2

func (c *OpenauthConfigFetcher) Close() error

Close closes the gRPC connection

func (*OpenauthConfigFetcher) GetConfigsByEntityName added in v1.0.2

func (c *OpenauthConfigFetcher) GetConfigsByEntityName(ctx context.Context, entityName string) (*openauth_v1.ListConfigsResponse, error)

func (*OpenauthConfigFetcher) GetConfigsByKeys added in v1.0.2

func (*OpenauthConfigFetcher) Logout added in v1.0.2

func (*OpenauthConfigFetcher) RefreshToken added in v1.0.2

func (*OpenauthConfigFetcher) SignIn added in v1.0.2

type ReadOptions

type ReadOptions struct {
	Watch         bool                                             // if true, will watch for config changes and update cfg accordingly
	DelayDuration time.Duration                                    // duration between each watch check, default is 1 minute
	OnChange      func(entity, key string, oldValue, newValue any) // callback function invoked when a config value changes
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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