tgstation-server 6.19.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
ClaimsPrincipalAccessor.cs
Go to the documentation of this file.
1using System;
2using System.Security.Claims;
3
4using Microsoft.AspNetCore.Http;
5
7{
10 {
12 public ClaimsPrincipal User => httpContextAccessor.HttpContext?.User
13 ?? throw new InvalidOperationException("HTTP context was not present!");
14
18 readonly IHttpContextAccessor httpContextAccessor;
19
25 IHttpContextAccessor httpContextAccessor)
26 {
27 this.httpContextAccessor = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor));
28 }
29 }
30}
ClaimsPrincipal User
Get the current ClaimsPrincipal.
readonly IHttpContextAccessor httpContextAccessor
The IHttpContextAccessor for the AuthorizationService.
ClaimsPrincipalAccessor(IHttpContextAccessor httpContextAccessor)
Initializes a new instance of the ClaimsPrincipalAccessor class.
Interface for accessing the current request's ClaimsPrincipal.
ClaimsPrincipal User
Get the current ClaimsPrincipal.