verifiernew

package
v0.0.0-...-fb95fdf Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Overview

Copyright 2023 Jesus Ruiz. All rights reserved. Use of this source code is governed by an Apache 2.0 license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InspectRuntime

func InspectRuntime() (baseDir string, withGoRun bool)

func NewLogin

func NewLogin(
	cfg *Config,
	authenticate authenticate,
	callback func(context.Context, string) string,
	issuerInterceptor *op.IssuerInterceptor,
) *login

func RequestOnBehalf

func RequestOnBehalf(w http.ResponseWriter, r *http.Request)

func StarDictFromFiberRequest

func StarDictFromFiberRequest(c *fiber.Ctx) *starlark.Dict

func StarDictFromHttpRequest

func StarDictFromHttpRequest(request *http.Request) (*starlark.Dict, error)

func Start

func Start(cfg *yaml.YAML) error

Types

type Client

type Client struct {
	Id           string   `json:"id,omitempty"`
	Type         string   `json:"type,omitempty"`
	Secret       string   `json:"secret,omitempty"`
	RedirectURIs []string `json:"redirectURIs,omitempty"`
}

type Config

type Config struct {
	ListenAddress          string   `json:"listenAddress,omitempty"`
	VerifierURL            string   `json:"verifierURL,omitempty"`
	AuthnPolicies          string   `json:"authnPolicies,omitempty"`
	SamedeviceWallet       string   `json:"samedeviceWallet,omitempty"`
	CredentialTemplatesDir string   `json:"credentialTemplatesDir,omitempty"`
	RegisteredClients      []Client `json:"registeredClients,omitempty"`
}

func ConfigFromMap

func ConfigFromMap(cfg *yaml.YAML) (*Config, error)

func (*Config) Copy

func (s *Config) Copy() Config

func (*Config) OverrideWith

func (s *Config) OverrideWith(other Config)

func (*Config) SetDefaults

func (s *Config) SetDefaults()

func (*Config) String

func (s *Config) String() string

func (*Config) Validate

func (s *Config) Validate() (err error)

type Decision

type Decision int

Decision can be Authenticate or Authorize

const Authenticate Decision = 1
const Authorize Decision = 2

func (Decision) String

func (d Decision) String() string

type PDP

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

PDP implements a simple Policy Decision Point in Starlark

func NewPDP

func NewPDP(fileName string) (*PDP, error)

func (PDP) HttpHandler

func (m PDP) HttpHandler(w http.ResponseWriter, r *http.Request)

func (*PDP) ParseAndCompileFile

func (m *PDP) ParseAndCompileFile() error

ParseAndCompileFile reads a file with Starlark code and compiles it, storing the resulting global dictionary for later usage. In particular, the compiled module should define two functions, one for athentication and the second for athorisation. ParseAndCompileFile can be called several times and will perform a new compilation every time, creating a new Thread and so the old ones will never be called again and eventually will be disposed.

func (PDP) TakeAuthnDecision

func (m PDP) TakeAuthnDecision(decision Decision, r *http.Request, credential string, protectedResource string) (bool, error)

TakeAuthnDecision is called when a decision should be taken for either Athentication or Authorization. The type of decision to evaluate is passed in the Decision argument. The rest of the arguments contain the information required for the decision. They are: - the Verifiable Credential with the information from the caller needed for the decision - the protected resource that the caller identified in the Credential wants to access

type Storage

type Storage interface {
	op.Storage
	// contains filtered or unexported methods
}

type VerifierServer

type VerifierServer struct {
	Config     *Config
	HTTPServer *http.Server
}

func New

func New(cfg *yaml.YAML) *VerifierServer

func (*VerifierServer) SetupServer

func (ver *VerifierServer) SetupServer(storage Storage, logger *slog.Logger, extraOptions ...op.Option) (chi.Router, error)

SetupServer creates an OIDC server with the configured verifier URL

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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