Skip to content

Commit

Permalink
chore : Update package
Browse files Browse the repository at this point in the history
  • Loading branch information
wzh425 committed Mar 15, 2024
1 parent 7b44082 commit 9c9d665
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
<PackageReference Include="Magicodes.IE.Csv" Version="2.6.4" />
<PackageReference Include="Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain" Version="$(MasaFrameworkPackageVersion)" />
<PackageReference Include="Masa.BuildingBlocks.Authentication.OpenIdConnect.Models" Version="1.0.1-preview.10.3" />
<PackageReference Include="Masa.BuildingBlocks.StackSdks.Auth.Contracts" Version="1.0.1-preview.10.2" />
<PackageReference Include="Masa.BuildingBlocks.StackSdks.Auth.Contracts" Version="1.0.1-preview.10.3" />
<!--<PackageReference Include="Masa.BuildingBlocks.StackSdks.Auth.Contracts" Version="$(MasaFrameworkPackageVersion)" />-->
<PackageReference Include="Masa.Contrib.Configuration.ConfigurationApi.Dcc" Version="$(MasaFrameworkPackageVersion)" />
<PackageReference Include="Masa.Contrib.Caching.Distributed.StackExchangeRedis" Version="$(MasaFrameworkPackageVersion)" />
<PackageReference Include="Masa.Contrib.SearchEngine.AutoComplete.ElasticSearch" Version="$(MasaFrameworkPackageVersion)" />
<PackageReference Include="Masa.Contrib.StackSdks.Auth" Version="1.0.1-preview.10.2" />
<PackageReference Include="Masa.Contrib.StackSdks.Auth" Version="1.0.1-preview.10.3" />
<PackageReference Include="Masa.Utils.Extensions.Enums" Version="$(MasaFrameworkPackageVersion)" />
<PackageReference Include="Masa.Utils.Extensions.Validations.FluentValidation" Version="$(MasaFrameworkPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ public async Task ImpersonateAsync(ImpersonateUserCommand command)

var token = Guid.NewGuid().ToString();
var key = CacheKey.ImpersonationUserKey(token);
await _distributedCacheClient.SetAsync(key, cacheItem, TimeSpan.FromMinutes(1));
await _distributedCacheClient.SetAsync(key, cacheItem, TimeSpan.FromMinutes(10));

command.Result = new ImpersonateOutput {
ImpersonationToken = token
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,6 @@ public async Task GetImpersonatedUserAsync(ImpersonatedUserQuery query)
}

query.Result = cacheItem;

await _distributedCacheClient.RemoveAsync(key);
//await _distributedCacheClient.RemoveAsync(key);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ public async Task<ImpersonateOutput> ImpersonateAsync(IEventBus eventBus, [FromB

[AllowAnonymous]
[RoutePattern("impersonate", StartWithBaseUri = true, HttpMethod = "Get")]
public async Task<ImpersonationCacheItem> GetImpersonatedUserAsync([FromServices] IEventBus eventBus, [FromQuery] string impersonationToken)
public async Task<ImpersonationCacheItem> GetImpersonatedAsync([FromServices] IEventBus eventBus, [FromQuery] string impersonationToken)
{
var query = new ImpersonatedUserQuery(impersonationToken);
await eventBus.PublishAsync(query);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageReference Include="AspNet.Security.OAuth.GitHub" Version="6.0.10" />
<PackageReference Include="AspNet.Security.OAuth.Weixin" Version="6.0.11" />
<PackageReference Include="Masa.BuildingBlocks.Authentication.OpenIdConnect.Models" Version="1.0.1-preview.10.3" />
<PackageReference Include="Masa.BuildingBlocks.StackSdks.Auth.Contracts" Version="1.0.1-preview.10.2" />
<PackageReference Include="Masa.BuildingBlocks.StackSdks.Auth.Contracts" Version="1.0.1-preview.10.3" />
<PackageReference Include="Masa.Contrib.Exceptions" Version="$(MasaFrameworkPackageVersion)" />
<PackageReference Include="Masa.Contrib.Caching.Distributed.StackExchangeRedis" Version="$(MasaFrameworkPackageVersion)" />
<PackageReference Include="Masa.Utils.Extensions.DependencyInjection" Version="$(MasaFrameworkPackageVersion)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
<PackageReference Include="Humanizer.Core.zh-CN" Version="2.14.1" />
<PackageReference Include="Mapster" Version="7.3.0" />
<PackageReference Include="Masa.Stack.Components" Version="0.0.440" />
<PackageReference Include="Masa.Stack.Components" Version="0.0.441" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.7" />
<!--Support GB2312-->
<PackageReference Include="System.Text.Encoding.CodePages" Version="6.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ private async Task GetRecommendApps()

private async Task GetImpersonationToken()
{
var impersonate = await AuthClient.UserService.ImpersonateAsync(UserId);
var input = new ImpersonateInputModel
{
UserId = UserId
};

var impersonate = await AuthClient.UserService.ImpersonateAsync(input);
if (impersonate != null)
{
impersonationToken = impersonate.ImpersonationToken;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public ImpersonationGrantValidator(IAuthClient authClient)
public async Task ValidateAsync(ExtensionGrantValidationContext context)
{
var impersonationToken = context.Request.Raw["impersonationToken"];
var environment = context.Request.Raw["environment"] ?? string.Empty;
if (string.IsNullOrEmpty(impersonationToken))
{
context.Result = new GrantValidationResult
Expand All @@ -29,7 +30,13 @@ public async Task ValidateAsync(ExtensionGrantValidationContext context)
return;
}

var cacheItem = await _authClient.UserService.GetImpersonatedUserAsync(impersonationToken);
var input = new GetImpersonateInputModel
{
ImpersonationToken = impersonationToken,
Environment = environment
};

var cacheItem = await _authClient.UserService.GetImpersonateAsync(input);
if (cacheItem is null)
{
context.Result = new GrantValidationResult
Expand Down
2 changes: 1 addition & 1 deletion src/Web/Masa.Auth.Web.Sso/Masa.Auth.Web.Sso.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<PackageReference Include="Masa.Contrib.Development.DaprStarter.AspNetCore" Version="$(MasaFrameworkPackageVersion)" />
<PackageReference Include="Masa.Contrib.StackSdks.Caller" Version="$(MasaFrameworkPackageVersion)" />
<PackageReference Include="Masa.Contrib.StackSdks.Config" Version="$(MasaFrameworkPackageVersion)" />
<PackageReference Include="Masa.Contrib.StackSdks.Auth" Version="1.0.1-preview.10.2" />
<PackageReference Include="Masa.Contrib.StackSdks.Auth" Version="1.0.1-preview.10.3" />
<PackageReference Include="Masa.Contrib.StackSdks.Mc" Version="$(MasaFrameworkPackageVersion)" />
<PackageReference Include="Masa.Contrib.StackSdks.Pm" Version="$(MasaFrameworkPackageVersion)" />
<PackageReference Include="Masa.Contrib.StackSdks.Tsc.OpenTelemetry" Version="$(MasaFrameworkPackageVersion)" />
Expand Down

0 comments on commit 9c9d665

Please sign in to comment.