userroles

package
v1.1.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 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 Option

type Option func(o *Options)

Option defines a single option function.

func WithLogger

func WithLogger(l log.Logger) Option

WithLogger configure the logger

func WithRevaGatewaySelector

func WithRevaGatewaySelector(selectable pool.Selectable[gateway.GatewayAPIClient]) Option

WithRevaGatewaySelector set the gatewaySelector option

func WithRoleMapping

func WithRoleMapping(roleMap []config.RoleMapping) Option

WithRoleMapping configures the map of OpenCloud role names to claims values

func WithRoleService

func WithRoleService(rs settingssvc.RoleService) Option

WithRoleService sets the roleservice instance to use

func WithRolesClaim

func WithRolesClaim(claim string) Option

WithRolesClaim sets the OIDC claim for looking up role names

func WithServiceAccount

func WithServiceAccount(c config.ServiceAccount) Option

WithServiceAccount configures the service account creator to use

type Options

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

Options defines the available options for this package.

type UserRoleAssigner

type UserRoleAssigner interface {
	// UpdateUserRoleAssignment is called by the account resolver middleware. It updates the user's role assignment
	// based on the user's (OIDC) claims. It adds the user's roles to the opaque data of the cs3.User struct
	UpdateUserRoleAssignment(ctx context.Context, user *cs3.User, claims map[string]interface{}) (*cs3.User, error)
	// ApplyUserRole can be called by proxy middlewares, it looks up the user's roles and adds them
	// the users "roles" key in the user's opaque data
	ApplyUserRole(ctx context.Context, user *cs3.User) (*cs3.User, error)
}

UserRoleAssigner allows providing different implementations for how users get their default roles assigned by the proxy during authentication

func NewDefaultRoleAssigner

func NewDefaultRoleAssigner(opts ...Option) UserRoleAssigner

NewDefaultRoleAssigner returns an implementation of the UserRoleAssigner interface

func NewOIDCRoleAssigner

func NewOIDCRoleAssigner(opts ...Option) UserRoleAssigner

NewOIDCRoleAssigner returns an implementation of the UserRoleAssigner interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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