Skip to content

Commit 26a9284

Browse files
authored
Merge branch 'dev' into po/successResponse
2 parents 6c01e5d + 4bc4725 commit 26a9284

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

src/Authentication/Authentication/Cmdlets/ConnectGraph.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@ public class ConnectGraph : PSCmdlet, IModuleAssemblyInitializer, IModuleAssembl
3131
[Parameter(ParameterSetName = Constants.AppParameterSet, Position = 3)]
3232
public string CertificateThumbprint { get; set; }
3333

34-
3534
[Parameter(Position = 4)]
3635
public string TenantId { get; set; }
3736

3837
[Parameter(Position = 5)]
3938
public SwitchParameter ForceRefresh { get; set; }
4039

40+
private CancellationTokenSource cancellationTokenSource;
41+
4142
protected override void BeginProcessing()
4243
{
4344
ValidateParameters();
@@ -54,26 +55,26 @@ protected override void ProcessRecord()
5455
base.ProcessRecord();
5556

5657
IAuthContext authConfig = new AuthContext { TenantId = TenantId };
57-
CancellationToken cancellationToken = CancellationToken.None;
5858

5959
if (ParameterSetName == Constants.UserParameterSet)
6060
{
6161
// 2 mins timeout. 1 min < HTTP timeout.
6262
TimeSpan authTimeout = new TimeSpan(0, 0, Constants.MaxDeviceCodeTimeOut);
63-
CancellationTokenSource cts = new CancellationTokenSource(authTimeout);
64-
cancellationToken = cts.Token;
65-
63+
cancellationTokenSource = new CancellationTokenSource(authTimeout);
6664
authConfig.AuthType = AuthenticationType.Delegated;
6765
authConfig.Scopes = Scopes ?? new string[] { "User.Read" };
6866
}
6967
else
7068
{
69+
cancellationTokenSource = new CancellationTokenSource();
7170
authConfig.AuthType = AuthenticationType.AppOnly;
7271
authConfig.ClientId = ClientId;
7372
authConfig.CertificateThumbprint = CertificateThumbprint;
7473
authConfig.CertificateName = CertificateName;
7574
}
7675

76+
CancellationToken cancellationToken = cancellationTokenSource.Token;
77+
7778
try
7879
{
7980
// Gets a static instance of IAuthenticationProvider when the client app hasn't changed.
@@ -84,7 +85,7 @@ protected override void ProcessRecord()
8485
else
8586
clientApplication = (authProvider as ClientCredentialProvider).ClientApplication;
8687

87-
// Incremental scope consent without re-instanciating the auth provider. We will use a static instance.
88+
// Incremental scope consent without re-instantiating the auth provider. We will use a static instance.
8889
GraphRequestContext graphRequestContext = new GraphRequestContext();
8990
graphRequestContext.CancellationToken = cancellationToken;
9091
graphRequestContext.MiddlewareOptions = new Dictionary<string, IMiddlewareOption>
@@ -136,6 +137,7 @@ protected override void ProcessRecord()
136137

137138
protected override void StopProcessing()
138139
{
140+
cancellationTokenSource.Cancel();
139141
base.StopProcessing();
140142
}
141143

src/Authentication/Authentication/Microsoft.Graph.Authentication.csproj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,17 @@
2121
<PreLoadAssemblies Include="$(RepoTools)Lib\System.Security.Cryptography.ProtectedData.dll" />
2222
</ItemGroup>
2323
<ItemGroup>
24-
<PackageReference Include="Microsoft.Graph.Auth" Version="1.0.0-preview.4" />
25-
<PackageReference Include="Microsoft.Graph.Core" Version="1.20.0" />
26-
<PackageReference Include="Microsoft.Identity.Client" Version="4.8.2" />
24+
<PackageReference Include="Microsoft.Graph.Auth" Version="1.0.0-preview.5" />
25+
<PackageReference Include="Microsoft.Graph.Core" Version="1.20.1" />
26+
<PackageReference Include="Microsoft.Identity.Client" Version="4.14.0" />
2727
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="5.6.0" />
2828
<PackageReference Include="Microsoft.IdentityModel.Logging" Version="5.6.0" />
2929
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="5.6.0" />
3030
<PackageReference Include="PowerShellStandard.Library" Version="5.1.0" />
3131
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
3232
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.6.0" />
33-
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="4.7.0" />
33+
<!--Always ensure this version matches the versions of System.Security.Cryptography.* dependencies of Microsoft.Identity.Client when targeting PowerShell 6 and below.-->
34+
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="4.3.0" />
3435
</ItemGroup>
3536
<Target Name="CopyFiles" AfterTargets="Build">
3637
<Copy SourceFiles="@(PreLoadAssemblies)" DestinationFolder="$(TargetDir)\PreloadAssemblies" />
Binary file not shown.

0 commit comments

Comments
 (0)