From 7470a9d95aa6c344051209087e112e1fd0627606 Mon Sep 17 00:00:00 2001 From: Mayue Date: Fri, 25 Aug 2023 16:32:27 +0800 Subject: [PATCH] feat:add post user claim --- .../Model/UserClaimValuesModel.cs | 11 +++++++++++ .../Service/IUserService.cs | 4 +++- .../Service/UserService.cs | 10 ++++++++-- 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 src/BuildingBlocks/StackSdks/Auth/Masa.BuildingBlocks.StackSdks.Auth.Contracts/Model/UserClaimValuesModel.cs diff --git a/src/BuildingBlocks/StackSdks/Auth/Masa.BuildingBlocks.StackSdks.Auth.Contracts/Model/UserClaimValuesModel.cs b/src/BuildingBlocks/StackSdks/Auth/Masa.BuildingBlocks.StackSdks.Auth.Contracts/Model/UserClaimValuesModel.cs new file mode 100644 index 000000000..ee42d73f3 --- /dev/null +++ b/src/BuildingBlocks/StackSdks/Auth/Masa.BuildingBlocks.StackSdks.Auth.Contracts/Model/UserClaimValuesModel.cs @@ -0,0 +1,11 @@ +// Copyright (c) MASA Stack All rights reserved. +// Licensed under the MIT License. See LICENSE.txt in the project root for license information. + +namespace Masa.BuildingBlocks.StackSdks.Auth.Contracts.Model; + +public class UserClaimValuesModel +{ + public Guid UserId { get; set; } + + public Dictionary ClaimValues { get; set; } = new(); +} diff --git a/src/BuildingBlocks/StackSdks/Auth/Masa.BuildingBlocks.StackSdks.Auth/Service/IUserService.cs b/src/BuildingBlocks/StackSdks/Auth/Masa.BuildingBlocks.StackSdks.Auth/Service/IUserService.cs index 63144f85d..a21aaf8ee 100644 --- a/src/BuildingBlocks/StackSdks/Auth/Masa.BuildingBlocks.StackSdks.Auth/Service/IUserService.cs +++ b/src/BuildingBlocks/StackSdks/Auth/Masa.BuildingBlocks.StackSdks.Auth/Service/IUserService.cs @@ -107,6 +107,8 @@ public interface IUserService Task UnbindRolesAsync(UnbindUserRolesModel model); - Task> GetGetClaimValuesAsync(Guid userId); + Task> GetClaimValuesAsync(Guid userId); + + Task AddClaimValuesAsync(UserClaimValuesModel userClaimValuesModel); } diff --git a/src/Contrib/StackSdks/Masa.Contrib.StackSdks.Auth/Service/UserService.cs b/src/Contrib/StackSdks/Masa.Contrib.StackSdks.Auth/Service/UserService.cs index dfd6900b4..54583fad3 100644 --- a/src/Contrib/StackSdks/Masa.Contrib.StackSdks.Auth/Service/UserService.cs +++ b/src/Contrib/StackSdks/Masa.Contrib.StackSdks.Auth/Service/UserService.cs @@ -370,10 +370,16 @@ public Task UnbindRolesAsync(UnbindUserRolesModel model) return _caller.PostAsync(requestUri, model); } - public async Task> GetGetClaimValuesAsync(Guid userId) + public async Task> GetClaimValuesAsync(Guid userId) { - var requestUri = $"api/user/ClaimValues/{userId}"; + var requestUri = $"api/user/claim-values/{userId}"; return await _caller.GetAsync>(requestUri) ?? new(); } + + public Task AddClaimValuesAsync(UserClaimValuesModel userClaimValuesModel) + { + var requestUri = $"api/user/claim-values"; + return _caller.PostAsync(requestUri, userClaimValuesModel); + } }