Esempio n. 1
0
        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);
        }
Esempio n. 3
0
 /// <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);
 }