feat(identity): enforce shared session and browser request security
This commit is contained in:
1 parent
7df521bd89
commit
86f562f5b6
23 files changed
+430
-121
No files matched your search
@@ -7,21 +7,15 @@ import (
|
||||
"lincodex/backend/internal/adapter/primary/http/api"
|
||||
)
|
||||
|
||||
// errSessionsNotImplemented rejects every session-protected request until the
|
||||
// session boundary exists. Its text stays in the server: the generated server
|
||||
// wraps it in *ogenerrors.SecurityError, which the problem responder answers
|
||||
// with a fixed 401 unauthenticated problem.
|
||||
// errSessionsNotImplemented is used by DenyAllSecurity, a test helper. Its text
|
||||
// stays in the server and maps to a fixed 401 unauthenticated problem.
|
||||
var errSessionsNotImplemented = errors.New("v1.DenyAllSecurity - sessions are not implemented")
|
||||
|
||||
// DenyAllSecurity implements api.SecurityHandler by rejecting every session
|
||||
// cookie and CSRF token, so no operation that requires a session is reachable
|
||||
// before server sessions exist. Operations that declare `security: []` do not
|
||||
// call it and keep their own behavior, which is 501 not_implemented until
|
||||
// their business logic exists.
|
||||
//
|
||||
// Session authentication will replace it. The generated server (ogen v1.24.0) evaluates the
|
||||
// schemes of an operation as follows; TestGeneratedServerSecurityOrder pins
|
||||
// the order and the context propagation:
|
||||
// cookie and CSRF token. Production bootstrap uses SessionSecurity instead;
|
||||
// tests use this helper when they need to verify a denied session. The
|
||||
// generated server evaluates schemes in type-name order. The contract test
|
||||
// pins the order and context propagation:
|
||||
//
|
||||
// - It evaluates sessionCookie before sessionCsrf, in the order of the
|
||||
// generated type names, and each step receives the context returned by
|
||||
@@ -41,7 +35,7 @@ var errSessionsNotImplemented = errors.New("v1.DenyAllSecurity - sessions are no
|
||||
// ogenerrors.ErrSecurityRequirementIsNotSatisfied}, without a Security
|
||||
// field, to Handler.NewError with the context of the last successful step.
|
||||
//
|
||||
// The intended mapping on top of that behavior:
|
||||
// SessionSecurity and Handler.NewError implement this mapping on top of that behavior:
|
||||
//
|
||||
// - HandleSessionCookie returns a context with the principal for a valid
|
||||
// session and ogenerrors.ErrSkipServerSecurity for a missing, unknown,
|
||||
|
||||
Reference in new issue
Block a user