Skip to main content

RtSecurityContext

Namespace: Meshmakers.Octo.Runtime.Contracts

Identity of the caller a repository session acts for. Carried on IOctoSession so the engine can stamp RtEntity.RtCreatedBy and, in later stages, enforce data-level permissions on reads and writes (AB#4969).

public record RtSecurityContext : IEquatable<RtSecurityContext>

Inheritance ObjectRtSecurityContext
Implements IEquatable<RtSecurityContext>

Fields

System

The system context: internal callers (pipelines, blueprint apply, migrations, background jobs). System sessions stamp no creator and bypass data-level permission checks.

public static RtSecurityContext System;

Properties

SubjectId

Subject id of the caller (user sub claim or client id); null for the system context.

public string SubjectId { get; set; }

Property Value

String

Roles

Role names of the caller, as issued in the token's role claims.

public IReadOnlyCollection<string> Roles { get; set; }

Property Value

IReadOnlyCollection<String>

IsSystem

True for internal callers acting without an end-user identity.

public bool IsSystem { get; set; }

Property Value

Boolean

Constructors

RtSecurityContext()

public RtSecurityContext()

Methods

ForUser(String, IEnumerable<String>)

Creates a context for an authenticated end user or client principal.

public static RtSecurityContext ForUser(string subjectId, IEnumerable<string> roles)

Parameters

subjectId String
Subject id of the caller

roles IEnumerable<String>
Role names from the caller's token

Returns

RtSecurityContext