Tôi đang gặp vấn đề lạ. Tôi đang đọc và tạo OpenID Connect server with ASOS
bài viết này ASOS - AspNet.Security.OpenIdConnect.Server.Làm cách nào để giải quyết tham chiếu kiểu 'BaseControlContext' ..... 'cho AspNet.Security.OpenIdConnect.Server
Tôi chỉ đơn giản là tạo ra giải pháp mẫu mới và thêm mới lớp lớp con AuthorizationProvider
của OpenIdConnectServerProvider và ghi đè lên các phương pháp ảo i.e. ExtractAuthorizationRequest
AuthorizationProvider.cs
public class AuthorizationProvider : OpenIdConnectServerProvider
{
public override Task ExtractAuthorizationRequest(ExtractAuthorizationRequestContext context)
{
// If a request_id parameter can be found in the authorization request,
// restore the complete authorization request stored in the user session.
if (!string.IsNullOrEmpty(context.Request.RequestId))
{
var payload = context.HttpContext.Session.Get(context.Request.RequestId);
if (payload == null)
{
context.Reject(
error: OpenIdConnectConstants.Errors.InvalidRequest,
description: "Invalid request: timeout expired.");
return Task.FromResult(0);
}
// Restore the authorization request parameters from the serialized payload.
using (var reader = new BsonReader(new MemoryStream(payload)))
{
foreach (var parameter in JObject.Load(reader))
{
// Avoid overriding the current request parameters.
if (context.Request.HasParameter(parameter.Key))
{
continue;
}
context.Request.SetParameter(parameter.Key, parameter.Value);
}
}
}
return Task.FromResult(0);
}
}
Issue: Ngay sau khi tôi thêm Microsoft.AspNetCore.Identity (2.0.0)
Gói NuGet vào dự án của tôi, context.Reject
bắt đầu cung cấp lỗi sau
"Tham chiếu đến loại 'BaseControlContext" xác nhận quyền sở hữu được xác định trong Microsoft.AspNetCore.Authentication, nhưng không thể tìm thấy.
Nhưng ngay sau khi tôi xóa Microsoft.AspNetCore.Identity
Phụ thuộc NuGet, lỗi biến mất và tất cả đều ổn.
Lưu ý:
- Tôi đang sử dụng VS 2017.
- Tôi đang sử dụng dotnetcore 2.0 SDK.
- Tôi đã tạo giải pháp bằng cách sử dụng .Net Core 2.0.
Cảm ơn ý kiến của bạn – immirza
Điều này cũng có nghĩa là tôi không thể triển khai IAppBuilder trong IApplicationBuilder bằng phương pháp UseOwin theo hướng dẫn chính thức của microsoft? Bạn có thể xem câu hỏi này không, vui lòng https://stackoverflow.com/questions/45847623/unable-to-configuer-iapplicationbuilder-useowin – immirza
@immirza Tôi không chắc tôi hiểu câu hỏi của bạn. ASOS cho ASP.NET Core (1.x hoặc 2.x) không phụ thuộc vào OWIN, vì vậy bạn không cần một adapter để làm cho nó hoạt động (đó là một thành phần cốt lõi của ASP.NET). – Pinpoint