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)); }
public void Authenticate() { userContext.Authenticate(Guid.Empty); }