public void OnAuthorization(AuthorizationContext filterContext) { if (!_authentication.Authorize(filterContext.HttpContext)) { throw new UnauthorizedAccessException(); } }
public void OnAuthorization(AuthorizationContext filterContext) { if (!_authentication.Authorize(filterContext.HttpContext)) { filterContext.Result = new HttpUnauthorizedResult(); } }
private void ButtonlogOn_Click(object sender, System.EventArgs e) { authenticationProcess.Authorize(new UserCredential() { Name = textBoxLogin.Text, Password = textBoxPassword.Text }); ClearTextFields(); Activate(); }
public async Task <IActionResult> Authorize([FromBody] Credentials credentials) { var token = await _authentication.Authorize(credentials); return(Json(token)); }