當我準備在我的解決方案中更新 IdentityServer 專案時,我遇到了一些問題。
在登錄方法中:
IdentityServer/Quickstart/Account/AccountController.cs
- ConsentResponse 不包含 Denied 的定義。
await _interaction.GrantConsentAsync(context, ConsentResponse.Denied);
- IClientStore 不包含 IsPkceClientAsync 的定義。
if (await _clientStore.IsPkceClientAsync(context.ClientId))
在 BuildLoginViewModelAsync 方法中:
IdentityServer/Quickstart/Account/AccountController.cs
- AccountOptions 不包含 WindowsAuthenticationSchemeName 的定義
var providers = schemes
.Where(x => x.DisplayName != null ||
(x.Name.Equals(AccountOptions.WindowsAuthenticationSchemeName, StringComparison.OrdinalIgnoreCase))
)
.Select(x => new ExternalProvider
{
DisplayName = x.DisplayName,
AuthenticationScheme = x.Name
}).ToList();
- AuthorizationRequest 不包含 ClientId 的定義
var client = await _clientStore.FindEnabledClientByIdAsync(context.ClientId);
在回呼方法中:
IdentityServer/Quickstart/Account/ExternalController.cs
- 當前背景關系中不存在名稱“ProcessLoginCallbackForOidc”
ProcessLoginCallbackForOidc(result, additionalLocalClaims, localSignInProps);
ProcessLoginCallbackForWsFed(result, additionalLocalClaims, localSignInProps);
ProcessLoginCallbackForSaml2p(result, additionalLocalClaims, localSignInProps);
- 沒有多載方法“SignInAsync”需要 5 個引數。
await HttpContext.SignInAsync(user.Id, name, provider, localSignInProps, additionalLocalClaims.ToArray());
uj5u.com熱心網友回復:
我做了一些研究并得出以下結論:您可以更改如下:
在登錄方法中: IdentityServer/Quickstart/Account/AccountController.cs
ConsentResponse 不包含 Denied 的定義。
await _interaction.GrantConsentAsync(context, ConsentResponse.Denied);
Change to:
await _interaction.DenyAuthorizationAsync(context, AuthorizationError.AccessDenied);
IClientStore 不包含 IsPkceClientAsync 的定義。
if (await _clientStore.IsPkceClientAsync(context.ClientId))
Change to:
if (context.IsNativeClient())
在 BuildLoginViewModelAsync 方法中: IdentityServer/Quickstart/Account/AccountController.cs
AccountOptions 不包含 WindowsAuthenticationSchemeName 的定義
var providers = schemes
.Where(x => x.DisplayName != null ||
(x.Name.Equals(AccountOptions.WindowsAuthenticationSchemeName, StringComparison.OrdinalIgnoreCase))
)
.Select(x => new ExternalProvider
{
DisplayName = x.DisplayName,
AuthenticationScheme = x.Name
}).ToList();
Change to:
var providers = schemes
.Where(x => x.DisplayName != null)
.Select(x => new ExternalProvider
{
DisplayName = x.DisplayName ?? x.Name,
AuthenticationScheme = x.Name
}).ToList();
AuthorizationRequest 不包含 ClientId 的定義
var client = await _clientStore.FindEnabledClientByIdAsync(context.ClientId);
Change to:
var client = await _clientStore.FindEnabledClientByIdAsync(context.Client.ClientId);
在回呼方法中: IdentityServer/Quickstart/Account/ExternalController.cs
當前背景關系中不存在名稱“ProcessLoginCallbackForOidc”
ProcessLoginCallbackForOidc(result, additionalLocalClaims, localSignInProps);
ProcessLoginCallbackForWsFed(result, additionalLocalClaims, localSignInProps);
ProcessLoginCallbackForSaml2p(result, additionalLocalClaims, localSignInProps);
Change to:
ProcessLoginCallback(result, additionalLocalClaims, localSignInProps);
沒有多載方法“SignInAsync”需要 5 個引數。
await HttpContext.SignInAsync(user.Id, name, provider, localSignInProps, additionalLocalClaims.ToArray());
Change to:
var isuser = new IdentityServerUser(user.Id)
{
DisplayName = name,
IdentityProvider = provider,
AdditionalClaims = additionalLocalClaims
};
await HttpContext.SignInAsync(isuser, localSignInProps);
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/414083.html
標籤:
