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.

  • 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 the caller may act in another tenant or scope by naming it (the Wow-Scope header).

  • attributes are further facts about the principal (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. 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
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 toOperator(actingElsewhere: Boolean = false): Operator?

The operator a command of this caller records: its subject as the id and its own tenantId; actingElsewhere 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