private void AssignUserIdentity(AuthorizationContext filterContext, UserModel userData) { var identity = new GenericIdentity(userData.Name, "Basic"); var principal = new GenericPrincipal(identity, userData.Groups.ToArray()); filterContext.HttpContext.User = principal; Thread.CurrentPrincipal = principal; }
private void CheckIsSignatureValid(ApiRequestEntity requestData, UserModel userData) { var expectSignature = this.ChiperTextHelper .GetSignature(userData.EncryptKey, userData.SaltKey, requestData.TimeStamp, requestData.Data); if (requestData.Signature != expectSignature) { throw new AuthorizeTokenFailureException("Signature not valid!"); } }