protected override void ProcessRecord() { base.ProcessRecord(); IAuthContext authConfig = GraphSession.Instance.AuthContext; if (authConfig == null) { ThrowTerminatingError( new ErrorRecord(new System.Exception("No application to sign out from."), Guid.NewGuid().ToString(), ErrorCategory.InvalidArgument, null)); } AuthenticationHelpers.Logout(authConfig); GraphSession.Instance.AuthContext = null; }
protected override void ProcessRecord() { base.ProcessRecord(); AuthConfig authConfig = SessionState.PSVariable.GetValue(Constants.GraphAuthConfigId) as AuthConfig; if (authConfig == null) { ThrowTerminatingError( new ErrorRecord(new System.Exception("No application to sign out from."), Guid.NewGuid().ToString(), ErrorCategory.InvalidArgument, null)); } AuthenticationHelpers.Logout(authConfig); SessionState.PSVariable.Remove(Constants.GraphAuthConfigId); }
/// <summary> /// Signs out of the provided <see cref="IAuthContext"/>. /// </summary> /// <param name="authContext">The <see cref="IAuthContext"/> to sign-out from.</param> public static void LogOut(IAuthContext authContext) { AuthenticationHelpers.Logout(authContext); }