CoSecCallerResolver

The caller of a request from the security context CoSec's pipeline built for it: CoSec authenticates the request and resolves its scope, deciding it itself or, behind a CoSec gateway (cosec.pipeline.mode=gateway), reading what the gateway verified from CoSec-Identity. This resolver turns that context into a Caller.

  • Unauthenticated: no security context, or one whose principal no credential proved (CoSec's authenticated), is no caller: the edge answers 401. So is a principal whose id is blank (empty or white space alone), whatever its roles: it proves no identity, and a tenant-level role does not make it one. An id is not trimmed: a is an id.

  • Tenant: the security context's; CoSec's default tenant (0) is CoSecCallerOptions.defaultTenant.

  • Owner and subject: the principal's id, the subject always. The owner is the principal's id for an owner-level caller, and none for a tenant-level one (CoSecCallerOptions.tenantRoles), such as an employee who ships every buyer's orders: the parts absent from a caller's scope are not checked.

  • Space: the space of CoSec's scope, which CoSec validated (CoSec-Space-Id, a space the principal has a role in); its default space is none. Wow-Space is not read: on a CoSec host the client names its space to CoSec.

  • Application (Caller.app): the app of CoSec's scope, the one CoSec evaluated the request in: the host's (cosec.authorization.scope.app-id), else the one the request's credential declares (a token's aud, an API key's app), or, behind a gateway, the one the gateway forwarded. None when the scope names no app.

  • Cross scope: CoSecCallerOptions.crossScopeRoles, held by a caller of the platform tenant.

  • Never a service identity: a service names itself on the internal port (Wow-Service), never through CoSec, so no principal asserts a synchronous call's root command, whatever headers its request carries.

  • Attributes: the principal's roles in its scope (Caller.ROLES, its Caller.roles), and every other attribute of the principal under its own name, the claims an access policy reads (caller.claims("departments")); a value is a list, an array or a comma-separated string. An attribute named as one of those the caller holds already (Caller.ROLES, Caller.APP) is not a claim: CoSec's roles and application win.

Constructors

Link copied to clipboard
constructor(options: CoSecCallerOptions = CoSecCallerOptions())

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun callerOf(context: SecurityContext): Caller?

The caller of context; null when it is anonymous, its principal's id is blank, or not one CoSec's pipeline built.

Link copied to clipboard
open suspend override fun resolve(request: ServerRequest): Caller?