authorities

package
v0.25.3 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthorityTypeOIDC = "oidc"
)

Supported Authority kind string values.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorityRegistration

type AuthorityRegistration struct {
	ID            string `yaml:"id"`
	Name          string `yaml:"name"`
	AuthorityType string `yaml:"authority_type"`

	Iss string `yaml:"iss"`

	ClientID     string `yaml:"client_id"`
	ClientSecret string `yaml:"client_secret"`

	Insecure bool  `yaml:"insecure"`
	Default  bool  `yaml:"default"`
	Discover *bool `yaml:"discover"`

	Scopes              []string `yaml:"scopes"`
	ResponseType        string   `yaml:"response_type"`
	CodeChallengeMethod string   `yaml:"code_challenge_method"`

	RawMetadataEndpoint      string `yaml:"metadata_endpoint"`
	RawAuthorizationEndpoint string `yaml:"authorization_endpoint"`

	JWKS *jose.JSONWebKeySet `yaml:"jwks"`

	IdentityClaimName string `yaml:"identity_claim_name"`

	IdentityAliases       map[string]string `yaml:"identity_aliases,flow"`
	IdentityAliasRequired bool              `yaml:"identity_alias_required"`
	// contains filtered or unexported fields
}

AuthorityRegistration defines an authority with its properties.

func (*AuthorityRegistration) Initialize

func (ar *AuthorityRegistration) Initialize(ctx context.Context, logger logrus.FieldLogger) error

Initialize initializes the associated registration with the provided context.

func (*AuthorityRegistration) Validate

func (ar *AuthorityRegistration) Validate() error

Validate validates the associated authority registration data and returns error if the data is not valid.

type Details

type Details struct {
	ID            string
	Name          string
	AuthorityType string

	ClientID     string
	ClientSecret string

	Insecure bool

	Scopes              []string
	ResponseType        string
	CodeChallengeMethod string

	Registration *AuthorityRegistration

	AuthorizationEndpoint *url.URL
	// contains filtered or unexported fields
}

Details hold detail information about authorities identified by ID.

func (*Details) IdentityClaimValue

func (d *Details) IdentityClaimValue(claims map[string]interface{}) (string, error)

IdentityClaimValue returns the claim value of the provided claims from the claim defined at the associated registration.

func (*Details) IsReady

func (d *Details) IsReady() bool

IsReady returns wether or not the assosiated registration entry was ready at time of creation of the associated details.

func (*Details) Keyfunc

func (d *Details) Keyfunc() jwt.Keyfunc

Keyfunc returns a key func to validate JWTs with the keys of the associated authority registration.

type Registry

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

Registry implements the registry for registered authorities.

func NewRegistry

func NewRegistry(ctx context.Context, registrationConfFilepath string, logger logrus.FieldLogger) (*Registry, error)

NewRegistry creates a new authorizations Registry with the provided parameters.

func (*Registry) Default

func (r *Registry) Default(ctx context.Context) *Details

Default returns the default authority from the associated registry if any.

func (*Registry) Get

func (r *Registry) Get(ctx context.Context, authorityID string) (*AuthorityRegistration, bool)

Get returns the registered authorities registration for the provided client ID.

func (*Registry) Lookup

func (r *Registry) Lookup(ctx context.Context, authorityID string) (*Details, error)

Lookup returns and validates the authority Detail information for the provided parameters from the accociated authority registry.

func (*Registry) Register

func (r *Registry) Register(authority *AuthorityRegistration) error

Register validates the provided authority registration and adds the authority to the accociated registry if valid. Returns error otherwise.

type RegistryData

type RegistryData struct {
	Authorities []*AuthorityRegistration `yaml:"authorities,flow"`
}

RegistryData is the base structure of our authority registration configuration file.

Jump to

Keyboard shortcuts

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