user

package
v6.2.13 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: GPL-3.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 CookieReader

type CookieReader interface {
	// Cookie returns the named cookie provided in the request.
	Cookie(name string) (*http.Cookie, error)
}

CookieReader is an interface for reading cookies from an HTTP request. It is implemented by echo.Context and http.Request.

type Session

type Session struct {
	// Save is a function that persists the session.
	Save func() error `json:"-"`
	// SubjectID identifies the requesting subject when the user session was created.
	// A session needs to be scoped to the subject, since the session gives access to the subject's wallets,
	// and the user session might contain session-bound credentials (e.g. NutsEmployeeCredential) that were issued by the subject.
	SubjectID string    `json:"subjectID"`
	Wallet    Wallet    `json:"wallet"`
	ExpiresAt time.Time `json:"expiresAt"`
}

Session is a session-bound Verifiable Credential wallet.

func CreateTestSession

func CreateTestSession(ctx context.Context, subjectID string) (context.Context, *Session)

func GetSession

func GetSession(ctx context.Context) (*Session, error)

GetSession retrieves the user session from the request context. If the user session is not found, an error is returned.

type SessionMiddleware

type SessionMiddleware struct {
	// Skipper defines a function to skip middleware.
	Skipper middleware.Skipper
	// TimeOut is the maximum lifetime of a user session.
	TimeOut time.Duration
	// Store is the session store to use for storing user sessions.
	Store storage.SessionStore
	// CookiePath is a function that returns the path for the user session cookie.
	CookiePath func(subjectID string) string
}

SessionMiddleware is Echo middleware that ensures a user session is available in the request context (unless skipped). If no session is available, a new session is created. All HTTP requests to which the middleware is applied must contain a tenant parameter in the HTTP request path, specified as ':did'

func (SessionMiddleware) Handle

type Wallet

type Wallet struct {
	Credentials []vc.VerifiableCredential
	// JWK is an in-memory key pair associated with the user's wallet in JWK form.
	JWK []byte
	// DID is the did:jwk DID of the user's wallet.
	DID did.DID
}

Wallet is a session-bound Verifiable Credential wallet. It's an in-memory wallet which contains the user's private key in plain text. This is OK, since the associated credentials are intended for protocol compatibility (OpenID4VP with a low-assurance NutsEmployeeCredential), when an actual user wallet is involved, this wallet isn't used.

func (Wallet) Key

func (w Wallet) Key() (jwk.Key, error)

Key returns the JWK as jwk.Key

Jump to

Keyboard shortcuts

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