manager

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package manager contains an identity manager responsible for refreshing sessions and creating users.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromOAuthToken

func FromOAuthToken(token *session.OAuthToken) *oauth2.Token

FromOAuthToken converts a session oauth token to oauth2.Token.

func ToOAuthToken

func ToOAuthToken(token *oauth2.Token) *session.OAuthToken

ToOAuthToken converts an oauth2.Token to a session oauth token.

Types

type Authenticator

type Authenticator interface {
	Refresh(context.Context, *oauth2.Token, identity.State) (*oauth2.Token, error)
	Revoke(context.Context, *oauth2.Token) error
	UpdateUserInfo(context.Context, *oauth2.Token, any) error
}

Authenticator is an identity.Provider with only the methods needed by the manager.

type Manager

type Manager struct {
	enabler.Enabler
	// contains filtered or unexported fields
}

A Manager refreshes identity information using session and user data.

func New

func New(
	options ...Option,
) *Manager

New creates a new identity manager.

func (*Manager) GetDataBrokerServiceClient

func (mgr *Manager) GetDataBrokerServiceClient() databroker.DataBrokerServiceClient

GetDataBrokerServiceClient gets the databroker client.

func (*Manager) RunEnabled

func (mgr *Manager) RunEnabled(ctx context.Context) error

RunEnabled runs the manager. This method blocks until an error occurs or the given context is canceled.

func (*Manager) RunLeased

func (mgr *Manager) RunLeased(ctx context.Context) error

RunLeased runs the identity manager when a lease is acquired.

func (*Manager) UpdateConfig

func (mgr *Manager) UpdateConfig(options ...Option)

UpdateConfig updates the manager with the new options.

type Option

type Option func(*config)

An Option customizes the configuration used for the identity manager.

func WithAuthenticator

func WithAuthenticator(authenticator Authenticator) Option

WithAuthenticator sets the authenticator in the config.

func WithDataBrokerClient

func WithDataBrokerClient(dataBrokerClient databroker.DataBrokerServiceClient) Option

WithDataBrokerClient sets the databroker client in the config.

func WithEnabled

func WithEnabled(enabled bool) Option

WithEnabled sets the enabled option in the config.

func WithEventManager

func WithEventManager(mgr *events.Manager) Option

WithEventManager passes an event manager to record events

func WithNow

func WithNow(now func() time.Time) Option

WithNow customizes the time.Now function used by the manager.

func WithSessionRefreshCoolOffDuration

func WithSessionRefreshCoolOffDuration(dur time.Duration) Option

WithSessionRefreshCoolOffDuration sets the session refresh cool-off duration used by the manager.

func WithSessionRefreshGracePeriod

func WithSessionRefreshGracePeriod(dur time.Duration) Option

WithSessionRefreshGracePeriod sets the session refresh grace period used by the manager.

func WithUpdateUserInfoInterval

func WithUpdateUserInfoInterval(dur time.Duration) Option

WithUpdateUserInfoInterval sets the update user info interval in the config.

Jump to

Keyboard shortcuts

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