Exemple #1
0
        protected override bool IsAuthorized(HttpActionContext actionContext)
        {
            var token = "";

            if (actionContext.Request.Headers.Contains("token"))
            {
                token = actionContext.Request.Headers.GetValues("token").First();
            }
            else if (actionContext.Request.Headers.Contains("Token"))
            {
                token = actionContext.Request.Headers.GetValues("Token").First();
            }

            if (!string.IsNullOrWhiteSpace(token))
            {
                var authentication = this.cremaHost.Dispatcher.Invoke(() =>
                {
                    return(userContext.Dispatcher.Invoke(() => userContext.Authenticate(Guid.Parse(token))));
                });

                return(authentication != null);
            }

            return(false);
        }
 public bool Authenticate(User user)
 {
     return(Context.Authenticate(user));
 }
Exemple #3
0
 public void Authenticate()
 {
     userContext.Authenticate(Guid.Empty);
 }