clients

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2019 License: AGPL-3.0-only Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientRegistration

type ClientRegistration struct {
	ID              string `yaml:"id"`
	Secret          string `yaml:"secret"`
	Name            string `yaml:"name"`
	ApplicationType string `yaml:"application_type"`

	Trusted       bool     `yaml:"trusted"`
	TrustedScopes []string `yaml:"trusted_scopes"`
	Insecure      bool     `yaml:"insecure"`

	RedirectURIs []string `yaml:"redirect_uris,flow"`
	Origins      []string `yaml:"origins,flow"`

	JWKS                       *gojwk.Key `yaml:"jwks"`
	RawRequestObjectSigningAlg string     `yaml:"request_object_signing_alg"`
}

ClientRegistration defines a client with its properties.

func (*ClientRegistration) Secure added in v0.19.0

func (cr *ClientRegistration) Secure(rawKid interface{}) (*Secured, error)

Secure looks up the a matching key from the accociated client registration and returns its public key part as a secured client.

type Details

type Details struct {
	ID          string `json:"id"`
	DisplayName string `json:"display_name"`
	RedirectURI string `json:"redirect_uri"`
	Trusted     bool   `json:"trusted"`
}

Details hold detail information about clients identified by ID.

type Registry

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

Registry implements the registry for registered clients.

func NewRegistry

func NewRegistry(trustedURI *url.URL, registrationConfFilepath string, logger logrus.FieldLogger) (*Registry, error)

NewRegistry created a new client Registry with the provided parameters.

func (*Registry) Get

func (r *Registry) Get(ctx context.Context, clientID string) (*ClientRegistration, bool)

Get returns the registerd clients registraion for the provided client ID.

func (*Registry) Lookup

func (r *Registry) Lookup(ctx context.Context, clientID string, clientSecret string, redirectURI *url.URL, originURIString string, withoutSecret bool) (*Details, error)

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

func (*Registry) Register

func (r *Registry) Register(client *ClientRegistration) error

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

func (*Registry) Validate

func (r *Registry) Validate(client *ClientRegistration, clientSecret string, redirectURIString string, originURIString string, withoutSecret bool) error

Validate checks if the provided client registration data complies to the provided parameters and returns error when it does not.

type RegistryData

type RegistryData struct {
	Clients []*ClientRegistration `yaml:"clients,flow"`
}

RegistryData is the base structur of our client registry configuration file.

type Secured added in v0.19.0

type Secured struct {
	ID              string
	DisplayName     string
	ApplicationType string

	Kid       string
	PublicKey crypto.PublicKey

	TrustedScopes []string
}

A Secured is a client records public key identified by ID.

Jump to

Keyboard shortcuts

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