Skip to content

Commit 18f39c5

Browse files
committed
Set AuthContext to null during disconnect.
1 parent b0c31bc commit 18f39c5

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

src/Authentication/Authentication.Test/Helpers/GraphSessionTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public void GraphSessionShouldBeInitilizedAfterInitializerIsCalled()
1515
}
1616

1717
[Fact]
18-
public void ShoudlOverwriteExistingGraphSession()
18+
public void ShouldOverwriteExistingGraphSession()
1919
{
2020
GraphSessionInitializer.InitializeSession();
2121
Guid originalSessionId = GraphSession.Instance._graphSessionId;
@@ -27,7 +27,7 @@ public void ShoudlOverwriteExistingGraphSession()
2727
}
2828

2929
[Fact]
30-
public void ShoudlNotOverwriteExistingGraphSession()
30+
public void ShouldNotOverwriteExistingGraphSession()
3131
{
3232
GraphSessionInitializer.InitializeSession();
3333
Guid originalSessionId = GraphSession.Instance._graphSessionId;

src/Authentication/Authentication/Cmdlets/DisconnectGraph.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protected override void ProcessRecord()
3131

3232
AuthenticationHelpers.Logout(authConfig);
3333

34-
SessionState.PSVariable.Remove(Constants.GraphAuthConfigId);
34+
GraphSession.Instance.AuthContext = null;
3535
}
3636

3737
protected override void StopProcessing()

src/Authentication/Authentication/Common/GraphSession.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ namespace Microsoft.Graph.PowerShell.Authentication
77
using System;
88
using System.Threading;
99
/// <summary>
10-
/// The current <see cref="GraphSession"/>.
10+
/// Contains methods to create, modify or obtain a thread safe static instance of <see cref="GraphSession"/>.
1111
/// </summary>
12-
public class GraphSession: IGraphSession
12+
public class GraphSession : IGraphSession
1313
{
1414
static GraphSession _instance;
1515
static bool _initialized = false;
@@ -50,6 +50,9 @@ public static GraphSession Instance
5050
}
5151
}
5252
}
53+
/// <summary>
54+
/// Creates a new GraphSession.
55+
/// </summary>
5356
public GraphSession()
5457
{
5558
_graphSessionId = Guid.NewGuid();

src/Authentication/Authentication/Models/AuthContext.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
// ------------------------------------------------------------------------------
44
namespace Microsoft.Graph.PowerShell.Authentication
55
{
6-
using Newtonsoft.Json;
76
public class AuthContext: IAuthContext
87
{
9-
[JsonIgnore]
108
private const string PowerShellClientId = "14d82eec-204b-4c2f-b7e8-296a70dab67e";
119
public string ClientId { get; set; }
1210
public string TenantId { get; set; }

0 commit comments

Comments
 (0)