public LogoutResult Logout(LogoutRequest request) { var result = new LogoutResult(); try { var user = _cache.RefreshAndGet( Users, request.UserName, new UserNotFoundException(string.Format("User Name: {0} not found", request.UserName)) ); UserManager.SecurityCheck(request.SecurityKey, user); result.Output = UserManager.Logout(user); result.UserName = user.UserName; result.Success = true; } catch (PokerException e) { result.Success = false; result.ErrorMessage = e.Message; Logger.Error(e, this); } return(result); }
public static async Task <PlayFabResult <LogoutResult> > Logout(LogoutRequest request) { //Save titleId var titleId = PlayFabSettings.TitleId; //Set titleId to editor; PlayFabSettings.TitleId = "editor"; object httpResult = await PlayFabHTTP.DoPost("/DeveloperTools/User/Logout", request, null, null); if (httpResult is PlayFabError) { PlayFabError error = (PlayFabError)httpResult; if (PlayFabSettings.GlobalErrorHandler != null) { PlayFabSettings.GlobalErrorHandler(error); } return(new PlayFabResult <LogoutResult> { Error = error, }); } string resultRawJson = (string)httpResult; var serializer = JsonSerializer.Create(PlayFabUtil.JsonSettings); var resultData = serializer.Deserialize <PlayFabJsonSuccess <LogoutResult> >(new JsonTextReader(new StringReader(resultRawJson))); LogoutResult result = resultData.data; //Set titleId back to what it was before. PlayFabSettings.TitleId = titleId; return(new PlayFabResult <LogoutResult> { Result = result }); }
public async Task Logout_ProcessAsync(int seqid, TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken) { var args = new LogoutArgs(); await args.ReadAsync(iprot, cancellationToken); await iprot.ReadMessageEndAsync(cancellationToken); var result = new LogoutResult(); try { result.Success = await _iAsync.LogoutAsync(args.Request, cancellationToken); await oprot.WriteMessageBeginAsync(new TMessage("Logout", TMessageType.Reply, seqid), cancellationToken); await result.WriteAsync(oprot, cancellationToken); } catch (TTransportException) { throw; } catch (Exception ex) { Console.Error.WriteLine("Error occurred in processor:"); Console.Error.WriteLine(ex.ToString()); var x = new TApplicationException(TApplicationException.ExceptionType.InternalError, " Internal error."); await oprot.WriteMessageBeginAsync(new TMessage("Logout", TMessageType.Exception, seqid), cancellationToken); await x.WriteAsync(oprot, cancellationToken); } await oprot.WriteMessageEndAsync(cancellationToken); await oprot.Transport.FlushAsync(cancellationToken); }
public async Task <LogoutResult> Logout(string?identityToken) { OidcClient oidcClient = CreateOidcClient(); LogoutResult logoutResult = await oidcClient.LogoutAsync(new LogoutRequest { IdTokenHint = identityToken }); return(logoutResult); }
public async Task <LogoutResult> Logout() { // OidcClient oidcClient = CreateOidcClient("oidcxamarin101:/signout-callback-oidc"); OidcClient oidcClient = CreateOidcClient(); LogoutResult logoutResult = await oidcClient.LogoutAsync(new LogoutRequest()); return(logoutResult); }
public async void Logout() { var result = new LogoutResult(); var response = await client.GetAsync(LogoutAddress); LogoutComplete(this, result); }
public static ErrorCode Logout(string passport, string ip, out string errorMessage) { if (passport == null || passport.Length < 10 || !passport.StartsWith("NP")) { errorMessage = "'passport' is null or corrupted."; return(ErrorCode.InvalidArgument); } if (ip == null) { try { ip = HttpContext.Current.Request.UserHostAddress; } catch (Exception) { errorMessage = "Getting user ip address from HttpContext failed."; return(ErrorCode.InvalidArgument); } } Default @default; try { @default = Authenticator.CreateClientFromPassport(passport); } catch (Authenticator.InvalidPassportException) { errorMessage = "'passport' is unrecognizable."; return(ErrorCode.InvalidArgument); } catch (Exception ex) { errorMessage = "A unknown exception occured while creating a soap client." + Environment.NewLine + ex.ToString(); ErrorLogger.WriteLog(ErrorCode.Unknown, errorMessage, ex.StackTrace, string.Empty, passport); return(ErrorCode.Unknown); } ErrorCode result; try { LogoutResult logoutResult = @default.Logout(passport, ip); errorMessage = logoutResult.strErrorMessage; result = (ErrorCode)logoutResult.nErrorCode; } catch (Exception ex2) { errorMessage = "A unknown exception occured while calling a soap method." + Environment.NewLine + ex2.ToString(); ErrorLogger.WriteLog(ErrorCode.SoapCallFailed, errorMessage, ex2.StackTrace, string.Empty, passport); result = ErrorCode.SoapCallFailed; } return(result); }
public bool Logout(string userName, int securityKey) { LogoutResult result = authenticationService.Logout(new LogoutRequest() { UserName = userName, SecurityKey = securityKey, }); if (!result.Success.HasValue || !result.Success.Value) { return(false); } return(true); }
public HttpResponseMessage Logout(LogoutRequest request) { var result = new LogoutResult(); try { result = service.Logout(request); } catch (Exception e) { result.ErrorMessage = e.Message; result.Success = false; return(Request.CreateResponse(HttpStatusCode.InternalServerError, result)); } return(Request.CreateResponse(HttpStatusCode.OK, result)); }
public IActionResult Logout() { LogoutResult result = userEntity.Logout(requestContext); if (result == LogoutResult.NotLoggedIn) { return(Unauthorized("Logout failed not logged in.")); } else if (result == LogoutResult.InvalidAuthenticationTokenFormat) { return(BadRequest("Logout failed, invalid Authenticationtoken- Format.")); } IActionResult actionResult = Ok("Logout Successful."); SetCookie(actionResult, ProjectConstants.AuthenticationTokenKey, string.Empty, null, DateTime.Now.AddMonths(-1)); return(actionResult); }
public async Task <LogoutResponse> LogoutAsync(LogoutRequest request, CancellationToken cancellationToken = default(CancellationToken)) { await OutputProtocol.WriteMessageBeginAsync(new TMessage("Logout", TMessageType.Call, SeqId), cancellationToken); var args = new LogoutArgs(); args.Request = request; await args.WriteAsync(OutputProtocol, cancellationToken); await OutputProtocol.WriteMessageEndAsync(cancellationToken); await OutputProtocol.Transport.FlushAsync(cancellationToken); var msg = await InputProtocol.ReadMessageBeginAsync(cancellationToken); if (msg.Type == TMessageType.Exception) { var x = await TApplicationException.ReadAsync(InputProtocol, cancellationToken); await InputProtocol.ReadMessageEndAsync(cancellationToken); throw x; } var result = new LogoutResult(); await result.ReadAsync(InputProtocol, cancellationToken); await InputProtocol.ReadMessageEndAsync(cancellationToken); if (result.__isset.success) { return(result.Success); } throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "Logout failed: unknown result"); }