Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade common, implement getserviceclient credential, invoke listene… #14073

Merged
merged 1 commit into from
Feb 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Accounts/Accounts/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Invoked on clear context listener in Azure session to be cleared when `Clear-AzContext` was executed

## Version 2.2.4
* Shown correct client request id on debug message [#13745]
Expand Down
3 changes: 2 additions & 1 deletion src/Accounts/Accounts/Context/ClearAzureRmContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

using System.IO;
using System.Management.Automation;

using Microsoft.Azure.Commands.Common.Authentication;
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
using Microsoft.Azure.Commands.Common.Authentication.Models;
Expand Down Expand Up @@ -86,6 +85,8 @@ void ClearContext(AzureRmProfile profile, RMProfileClient client)
}
}

AzureSession.Instance.RaiseContextClearedEvent();

if (PassThru.IsPresent)
{
WriteObject(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ public string UserId

private readonly Func<string> _refresh;

public ExternalAccessToken(string token, Func<string> refresh = null)
public ExternalAccessToken(string accessToken, Func<string> renew = null)
{
this.AccessToken = token;
this._refresh = refresh;
this.AccessToken = accessToken;
this._refresh = renew;
}

public void AuthorizeRequest(Action<string, string> authTokenSetter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,11 @@ public ServiceClientCredentials GetServiceClientCredentials(IAzureContext contex
}
}

public ServiceClientCredentials GetServiceClientCredentials(string accessToken, Func<string> renew = null)
{
return new RenewingTokenCredential(new ExternalAccessToken(accessToken, renew));
}

/// <summary>
/// Remove a user from token cache.
/// </summary>
Expand Down
32 changes: 16 additions & 16 deletions tools/Common.Netcore.Dependencies.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
<ItemGroup>
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.20"/>
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure" Version="3.3.19"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Aks" Version="1.3.30-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Authentication.Abstractions" Version="1.3.30-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Authorization" Version="1.3.30-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Common" Version="1.3.30-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Compute" Version="1.3.30-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Graph.Rbac" Version="1.3.30-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.KeyVault" Version="1.3.30-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Monitor" Version="1.3.30-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Network" Version="1.3.30-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.PolicyInsights" Version="1.3.30-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.ResourceManager" Version="1.3.30-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Storage" Version="1.3.30-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Storage.Management" Version="1.3.30-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Strategies" Version="1.3.30-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Websites" Version="1.3.30-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Aks" Version="1.3.31-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Authentication.Abstractions" Version="1.3.31-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Authorization" Version="1.3.31-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Common" Version="1.3.31-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Compute" Version="1.3.31-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Graph.Rbac" Version="1.3.31-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.KeyVault" Version="1.3.31-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Monitor" Version="1.3.31-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Network" Version="1.3.31-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.PolicyInsights" Version="1.3.31-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.ResourceManager" Version="1.3.31-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Storage" Version="1.3.31-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Storage.Management" Version="1.3.31-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Strategies" Version="1.3.31-preview"/>
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Websites" Version="1.3.31-preview"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Azure.Core" Version="1.7.0"/>
Expand All @@ -35,7 +35,7 @@
<PackageReference Include="PowerShellStandard.Library" Version="5.1.0" PrivateAssets="All" />
</ItemGroup>
<PropertyGroup>
<StorageToolsPath>$(NugetPackageRoot)\microsoft.azure.powershell.storage\1.3.30-preview\tools\</StorageToolsPath>
<StorageToolsPath>$(NugetPackageRoot)\microsoft.azure.powershell.storage\1.3.31-preview\tools\</StorageToolsPath>
</PropertyGroup>
<ItemGroup Condition="'$(OmitJsonPackage)' != 'true'">
<PackageReference Include="Newtonsoft.Json" Version="10.0.3"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ public Rest.ServiceClientCredentials GetServiceClientCredentials(IAzureContext c
throw new System.NotImplementedException();
}

public Rest.ServiceClientCredentials GetServiceClientCredentials(string accessToken, Func<string> renew = null)
{
throw new System.NotImplementedException();
}

public void RemoveUser(IAzureAccount account, IAzureTokenCache tokenCache)
{
throw new NotImplementedException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ public ServiceClientCredentials GetServiceClientCredentials(IAzureContext contex
return new Microsoft.Rest.TokenCredentials(Token.AccessToken);
}

public Rest.ServiceClientCredentials GetServiceClientCredentials(string accessToken, Func<string> renew = null)
{
throw new System.NotImplementedException();
}

public void RemoveUser(IAzureAccount account, IAzureTokenCache tokenCache)
{
throw new NotImplementedException();
Expand Down