Skip to content
Tracon

RunAuthorizationResult

Namespace Tracon · Assembly Tracon.Abstractions.dll

The outcome of an authorization decision.

public sealed record RunAuthorizationResult : IEquatable<RunAuthorizationResult>

objectRunAuthorizationResult

IEquatable<RunAuthorizationResult>

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

public RunAuthorizationResult()

Gets whether the call may proceed.

public required bool IsAllowed { get; init; }

bool

Gets the text returned to the caller as the denial reason. null when allowed.

public string? Reason { get; init; }

string?

This text reaches the HTTP response’s ProblemDetails.Detail field, so it carries no secret.

Creates an allowing result.

public static RunAuthorizationResult Allow()

RunAuthorizationResult

A result with RunAuthorizationResult.IsAllowed set to true.

Creates a denying result.

public static RunAuthorizationResult Deny(string reason)

reason string

The text returned to the caller as the denial reason.

RunAuthorizationResult

A result with RunAuthorizationResult.IsAllowed set to false.

ArgumentException

reason is empty or whitespace.

public override bool Equals(object? obj)

obj object?

bool

public bool Equals(RunAuthorizationResult? other)

other RunAuthorizationResult?

bool

public override int GetHashCode()

int

public override string ToString()

string

operator ==(RunAuthorizationResult?, RunAuthorizationResult?)

Section titled “ operator ==(RunAuthorizationResult?, RunAuthorizationResult?)”
public static bool operator ==(RunAuthorizationResult? left, RunAuthorizationResult? right)

left RunAuthorizationResult?

right RunAuthorizationResult?

bool

operator !=(RunAuthorizationResult?, RunAuthorizationResult?)

Section titled “ operator !=(RunAuthorizationResult?, RunAuthorizationResult?)”
public static bool operator !=(RunAuthorizationResult? left, RunAuthorizationResult? right)

left RunAuthorizationResult?

right RunAuthorizationResult?

bool