public override void OnActionExecuting(HttpActionContext context) { Exception exception = null; try { foreach (var arg in context.ActionArguments.Values) { var req = arg as IAuthTokenHolder; if (req == null) { continue; } var tokenData = TokenProvider.Decrypt(req.AuthToken); TokenValidation.ValidateToken(tokenData.ToString()); return; } } catch (Exception current) { exception = current; } var executedContext = new HttpActionExecutedContext(context, exception ?? new ValidationException("Authentication token not found")); context.Response = GetResponseByException(executedContext); }
private Guid GetPlayerIdFromToken(IAuthTokenHolder request) { return(TokenProvider.Decrypt(request.AuthToken)); }