我想像这样向 angular-auth-oidc-client 授权方法添加一个自定义参数。在这种情况下使用自定义参数 client_id 我想编写一些自定义逻辑。
export class LoginComponent implements OnInit {
constructor(private oidcSecurityService: OidcSecurityService) {
}
ngOnInit() {
this.oidcSecurityService.authorize({customParams: { 'client_id': 'F93C5C9E-57DC-4889-86DD-66A98EAD94CC' } });
}
}
在后端,我在 .net core 3.1 应用程序中设置了 identityserver4。我还实现了自定义ProfileService
public class ProfileService : IProfileService
{
protected UserManager<ApplicationUser> _userManager;
public ProfileService(UserManager<ApplicationUser> userManager)
{
_userManager = userManager;
}
public async Task GetProfileDataAsync(ProfileDataRequestContext context)
{
//>Processing
var user = await _userManager.GetUserAsync(context.Subject);
var claims = new List<Claim>
{
new Claim("FullName", user.FullName),
};
context.IssuedClaims.AddRange(claims);
}
public async Task IsActiveAsync(IsActiveContext context)
{
//>Processing
var user = await _userManager.GetUserAsync(context.Subject);
context.IsActive = (user != null) && user.IsActive;
}
}
也在startup.cs
services.AddIdentityServer()
.AddProfileService<ProfileService>();
如何在我的 .net 核心应用程序中访问从 angular oidc 客户端发送的自定义参数?
如果需要任何其他信息,请告诉我。