Skip to content

AuthorizationExtensions class

namespace: Serenity   assemblySerenity.Net.Core

Provides helper extension methods for authorization, permission checks, and user retrieval.

public static class AuthorizationExtensions

Public Members

name description
static GetIdentifier(…) Gets the value of the NameIdentifier claim from the specified principal.
static GetUserDefinition(…) Gets the user definition for the specified principal. (3 methods)
static GetUserDefinition<TUserDefinition>(…) Gets the typed user definition for the specified principal.
static Impersonate(…) Impersonates the user with the specified username.
static IsLoggedIn(…) Determines whether the user accessed via userAccessor is authenticated. (2 methods)
static RemoveCachedUser(…) Removes the specified user from the cache. (2 methods)
static ValidateLoggedIn(…) Ensures a user is currently authenticated, throwing a validation error with code NotLoggedIn otherwise.
static ValidatePermission(…) Ensures the current user has the specified permission, throwing a validation error with code AccessDenied otherwise.

See Also