internal static async Task CheckAuthorizationAsync(string sessionToken, MethodBase methodeBase, AccessType accessType) { sessionToken.CheckArgument(nameof(sessionToken)); methodeBase.CheckArgument(nameof(methodeBase)); bool handled = false; BeforeCheckAuthorization(sessionToken, methodeBase, accessType, ref handled); if (handled == false) { await CheckAuthorizationInternalAsync(sessionToken, methodeBase, accessType).ConfigureAwait(false); } AfterCheckAuthorization(sessionToken, methodeBase, accessType); }
internal static void CheckAuthorization(string sessionToken, MethodBase methodeBase) { sessionToken.CheckArgument(nameof(sessionToken)); methodeBase.CheckArgument(nameof(methodeBase)); bool handled = false; BeforeCheckAuthorization(sessionToken, methodeBase, ref handled); if (handled == false) { CheckAuthorizationInternal(sessionToken, methodeBase); } AfterCheckAuthorization(sessionToken, methodeBase); }
protected virtual void CheckAuthorization(Type instanceType, MethodBase methodeBase) { instanceType.CheckArgument(nameof(instanceType)); methodeBase.CheckArgument(nameof(methodeBase)); bool handled = false; BeforeCheckAuthorization(instanceType, methodeBase, ref handled); if (handled == false) { var authorizeAttribute = methodeBase.GetCustomAttribute <AuthorizeAttribute>(); authorizeAttribute = authorizeAttribute ?? instanceType.GetCustomAttribute <AuthorizeAttribute>(); if (authorizeAttribute != null) { CheckAuthorizeAttribute(authorizeAttribute); } } AfterCheckAuthorization(instanceType, methodeBase); }