Caller

class Caller @InternalWowApi constructor(val tenantId: String = DEFAULT_TENANT, val scope: Scope = Scope.NONE, val subject: String? = null, val crossScope: Boolean = false, val attributes: Map<String, List<String>> = emptyMap(), val service: Boolean = false)

Who sends a command or runs a query, as the edge authenticated it: the facts admission takes a command's identity from (identity comes from the principal, never from the path or the body), and the facts an access policy (me.ahoo.wow.api.access.AccessPolicy) compares and a read authorizer (ReadAuthorizer) decides by. Commands and queries share it: the edge resolves one per request.

  • tenantId is the caller's tenant; a principal without one is in DEFAULT_TENANT. A platform role (PlatformRoles) counts only for a caller of PLATFORM_TENANT.

  • scope is the caller's owner and space: the scope it acts in.

  • subject is the principal's opaque id, for authorizers, logs and the Operator of what it commits; null for an anonymous caller.

  • crossScope says two things of the caller: it may name any other tenant or scope in the Wow-Scope header, and it reaches every tenant where a route reads reach (an operator's routes: the parked entries, the subscriptions). A target the service reserves (the view store's owner (shared), TenantPolicy.reservedTargets) is named by any caller without it, and gives neither: no reach, and no other target (#7333).

  • attributes are further facts about the principal (its roles, policies, claims) that an authorizer, a read authorizer (ReadAuthorizer) or an access policy (me.ahoo.wow.api.access.AccessPolicy) may read. They live only as long as the request: none of them is written into a fact, but for the standard attribute APP, the calling application, which the edge records as the command's request fact me.ahoo.wow.api.decide.RequestFacts.APP_ID.

  • service says the caller is a service identity: another service of the system, which names itself on the internal port that only the platform's own services reach, calling for a saga of its own; the public routes refuse a caller their resolver returns as one. Only such a caller may assert the root command a call acts for (its tenant, scope, operator and causation, the Wow-Call header); the edge refuses that header from any other caller. A service identity has a subject.

A caller is the runtime's view of one request; the Operator is what a commit records of it (toOperator).

Fields may be added: construct one with of; the constructor is internal to Wow.

Constructors

Link copied to clipboard
constructor(tenantId: String = DEFAULT_TENANT, scope: Scope = Scope.NONE, subject: String? = null, crossScope: Boolean = false, attributes: Map<String, List<String>> = emptyMap(), service: Boolean = false)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val app: String?

The application the caller calls from: the first value of its APP attribute, which only its resolver sets, from what it authenticated (CoSec's resolver: the application CoSec authorized the request in); null when it has none. Access policies (me.ahoo.wow.api.access.AccessPolicy) and read authorizers (ReadAuthorizer) read it here, and a command records it as its request fact me.ahoo.wow.api.decide.RequestFacts.APP_ID.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The caller's roles: the values of its ROLES attribute, none when it has none. Wow's resolvers set it, the development callers from the Wow-Roles header and CoSec's from the principal's roles in the request's scope, and an application's own resolver puts the roles it authenticated there. A role is the identity system's name; Wow gives none a meaning.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun copyWith(tenantId: String = this.tenantId, scope: Scope = this.scope, subject: String? = this.subject, crossScope: Boolean = this.crossScope, attributes: Map<String, List<String>> = this.attributes, service: Boolean = this.service): Caller

This Caller with the given fields replaced: Wow's own copy, left out of the ABI.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun hasRole(role: String): Boolean

Whether the caller holds the role role, one of its roles.

Link copied to clipboard
fun toOperator(actedElsewhere: Boolean = false): Operator?

The operator a command of this caller records: its subject as the id and its own tenantId; actedElsewhere when the command acts in another tenant or scope than the caller's own, through Wow-Scope. Null for an anonymous caller.

Link copied to clipboard
open override fun toString(): String