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 ¶
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 ¶
func (u SessionMiddleware) Handle(next echo.HandlerFunc) echo.HandlerFunc
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.