/// <summary> /// Activates the system block on the user associated with the specified Id. /// </summary> /// <param name="token"></param> /// <param name="blockedId"></param> /// <returns></returns> public async Task BlockUser(string token, string blockedId) { try { await _loginTokenManager.VerifyAsync(token); UserModel userToBlock = await GetUserById(token, blockedId); Enum.TryParse(userToBlock.RegistrationType, out RegistrationTypeEnum registrationType); await _blockHandlers[registrationType](userToBlock.RegistrationKey); } catch (Exception e) { throw e; } }
public async Task <IHttpActionResult> VerifyAuth([FromBody] AccessTokenDto accessToken) { try { var userId = await _loginTokenManager.VerifyAsync(accessToken.Token); return(Ok(userId)); } catch (AuthenticationException) { return(BadRequest("Authentication was not approved")); } catch (Exception e) { return(InternalServerError()); } }