Skip to content

DapperMaticCallerSession ​

Namespace: MJCZone.DapperMatic.AspNetCore.Security

Assembly: MJCZone.DapperMatic.AspNetCore

Summary ​

One caller's session with DapperMatic: who is calling, for which tenant, with which values. An HTTP request has one, built before its endpoint runs; so does a stream for as long as it is open, and a socket once its caller has signed in on it. Built by DapperMaticAccess.

sealed public

Contents ​

Methods (6) | Properties (6)

Methods ​

MethodSummary
OfGets a request's session, once built: by a DapperMatic endpoint, or by CancellationToken)....
CheckAsyncChecks the session before it is used again, as a stream does before each re-run and a socket before ...
GetType
ToString
Equals
GetHashCode

Of ​

Gets a request's session, once built: by a DapperMatic endpoint, or by CancellationToken).

csharp
DapperMaticCallerSession? Of(HttpContext http)

Parameters ​

  • http (HttpContext) - The request.

Returns ​

Type: DapperMaticCallerSession?

The session, or null if none was built for it.

CheckAsync ​

Checks the session before it is used again, as a stream does before each re-run and a socket before each operation: the policies and tenants DapperMatic keeps are read again if they are due, and a session whose tenant they now describe differently is built again from the same request.

csharp
ValueTask<DapperMaticCallerSession> CheckAsync(
    CancellationToken cancellationToken)

Parameters ​

  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: ValueTask<DapperMaticCallerSession>

The session to use: this one, or one built again.

GetType ​

csharp
GetType()

ToString ​

csharp
ToString()

Equals ​

csharp
Equals()

GetHashCode ​

csharp
GetHashCode()

Properties ​

Current ​

Gets the session the current code runs in: the request's, within a DapperMatic endpoint; null elsewhere.

Type: DapperMaticCallerSession?

User ​

Gets the caller, as DapperMatic's checks see them: their identities, and the roles found in other claims or by code (<c>RolesFrom</c>).

Type: ClaimsPrincipal

Access ​

Gets the caller's access context: the tenant and the values policies and lookups read.

Type: DmAccessContext

Tenant ​

Gets the caller's tenant, or null for none.

Type: DmTenant?

StartedAt ​

Gets when the session began.

Type: DateTimeOffset

ExpiresAt ​

Gets when the session ends: when the caller's token expires, or at MaxSessionAge, whichever comes first; null for never. A stream or socket ends with it, and its client signs in again.

Type: DateTimeOffset?