Skip to main content
Table of Contents

Class AuthorizationException

Namespace
Stratara.Abstractions.Authorization
Assembly
Stratara.Abstractions.dll

Thrown by the authorizing mediator/dispatcher decorators when the caller does not hold a role required by RequireRoleAttribute on the dispatched request type. Permission failures (RequirePermissionAttribute) throw the derived PermissionAuthorizationException, so a single catch of this base type maps every authorization denial (typically to HTTP 403).

public class AuthorizationException : Exception, ISerializable
Inheritance
AuthorizationException
Implements
Derived
Inherited Members
Extension Methods

Constructors

AuthorizationException(string)

Initialise a new AuthorizationException for the named role.

public AuthorizationException(string role)

Parameters

role string

The role the caller was missing.

AuthorizationException(string, string)

Initialise with a custom message; used by derived denial types.

protected AuthorizationException(string requirement, string message)

Parameters

requirement string

The requirement the caller was missing (mirrored into RequiredRole).

message string

The exception message.

Properties

RequiredRole

The requirement the caller did not hold. For role denials this is the role name; derived denial types mirror their specific requirement here so role-era handlers keep logging something meaningful.

public string RequiredRole { get; }

Property Value

string