idtransform

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package idtransform defines upstream-to-downstream identity transformations which could be implemented using various approaches or languages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IdentityTransformation

type IdentityTransformation interface {
	Evaluate(ctx context.Context, username string, groups []string) (*TransformationResult, error)

	// Source returns some representation of the original source code of the transformation, which is
	// useful for tests to be able to check that a compiled transformation came from the right source.
	Source() any
}

IdentityTransformation is an individual identity transformation which can be evaluated.

type TransformationPipeline

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

TransformationPipeline is a list of identity transforms, which can be evaluated in order against some given input values.

func NewTransformationPipeline

func NewTransformationPipeline() *TransformationPipeline

NewTransformationPipeline creates an empty TransformationPipeline.

func (*TransformationPipeline) AppendTransformation

func (p *TransformationPipeline) AppendTransformation(t IdentityTransformation)

AppendTransformation adds a transformation to the end of the list of transformations for this pipeline. This is not thread-safe, so be sure to add all transformations from a single goroutine before using Evaluate from multiple goroutines.

func (*TransformationPipeline) Evaluate

func (p *TransformationPipeline) Evaluate(ctx context.Context, username string, groups []string) (*TransformationResult, error)

Evaluate runs the transformation pipeline for a given input identity. It returns a potentially transformed or rejected identity, or an error. If any transformation in the list rejects the authentication, then the list is short-circuited but no error is returned. Only unexpected errors are returned as errors. This is safe to call from multiple goroutines.

func (*TransformationPipeline) Source

func (p *TransformationPipeline) Source() []any

type TransformationResult

type TransformationResult struct {
	Username                      string   // the new username for an allowed auth
	Groups                        []string // the new group names for an allowed auth
	AuthenticationAllowed         bool     // when false, disallow this authentication attempt
	RejectedAuthenticationMessage string   // should be set when AuthenticationAllowed is false
}

TransformationResult is the result of evaluating a transformation against some inputs.

Jump to

Keyboard shortcuts

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