public void OnEntry(IMethodContextAdapter methodContext, string role) { Console.WriteLine("[Auth] Checking if user is in {0} role", role); if (UserIsInRole(role)) { Console.WriteLine("[Auth] User IS authorized"); return; } Console.WriteLine("[Auth] User is NOT authorized"); methodContext.AbortMethod(); UnauthorizedAccess(); }
public void OnEntry(IMethodContextAdapter methodContext, string role) { Console.WriteLine("[Auth] Checking if user is in {0} role", role); if (UserIsInRole(role)) { Console.WriteLine("[Auth] User IS authorized"); return; } Console.WriteLine("[Auth] User is NOT authorized"); methodContext.AbortMethod(); UnauthorizedAccess(); }
public void OnEntry(IMethodContextAdapter methodContext) { var cacheKey = BuildCacheKey(methodContext); if (!_cache.ContainsKey(cacheKey)) { Console.WriteLine("[Cache] MISS for {0}", cacheKey); methodContext.Tag = cacheKey; return; } Console.WriteLine("[Cache] HIT for {0}", cacheKey); methodContext.ReturnValue = _cache[cacheKey]; methodContext.AbortMethod(); }
public void OnEntry(IMethodContextAdapter methodContext) { var cacheKey = BuildCacheKey(methodContext); if (!_cache.ContainsKey(cacheKey)) { Console.WriteLine("[Cache] MISS for {0}", cacheKey); methodContext.Tag = cacheKey; return; } Console.WriteLine("[Cache] HIT for {0}", cacheKey); methodContext.ReturnValue = _cache[cacheKey]; methodContext.AbortMethod(); }