Пример #1
0
 public PermissionValueCheckContext(PermissionDefinition permission,
                                    string userId,
                                    string scopeId  = null,
                                    string tenantId = null)
 {
     Permission = permission ?? throw new ArgumentNullException(nameof(permission));
     UserId     = userId;
     ScopeId    = scopeId;
     TenantId   = tenantId;
 }
Пример #2
0
 public PermissionValueCheckContext(PermissionDefinition permission,
                                    ClaimsPrincipal principal,
                                    string scopeId = null)
 {
     Permission = permission ?? throw new ArgumentNullException(nameof(permission));
     Principal  = principal;
     ScopeId    = scopeId;
     TenantId   = principal?.FindFirst("tenantId")?.Value;
     UserId     = principal?.FindFirst(JwtClaimTypes.Subject)?.Value;
 }