[英]Error CS0122 'AuthenticationOptions' is inaccessible due to its protection level
I was following this guide to write my own Katana authentication middleware . 我按照本指南编写了自己的Katana身份验证中间件 。
Now I encountered a problem when I'm writing the AuthenticationOptions. 现在我在编写AuthenticationOptions时遇到了问题。 I get an "inaccessible due to its protection level" when I inherent from Microsoft.Owin.Security.AuthenticationOptions.
当我从Microsoft.Owin.Security.AuthenticationOptions固有时,我得到“由于其保护级别而无法访问”。 The thing is that this class is protected, so it should not be inaccessible?
问题是这个类是受保护的,所以它不应该是不可访问的? I have tried to do a clean and rebuild, but I still get the same error.
我试图做一个干净的重建,但我仍然得到同样的错误。 I must be missing something?
我肯定错过了什么?
My class: 我的课:
using Microsoft.Owin;
using Microsoft.Owin.Security;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Dummy
{
public class DummyAuthenticationOptions : AuthenticationOptions
{
public DummyAuthenticationOptions(string userName, string userId)
: base(Constants.DefaultAuthenticationType)
{
Description.Caption = Constants.DefaultAuthenticationType;
CallbackPath = new PathString("/signin-dummy");
AuthenticationMode = AuthenticationMode.Passive;
UserName = userName;
UserId = userId;
}
public PathString CallbackPath { get; set; }
public string UserName { get; set; }
public string UserId { get; set; }
public string SignInAsAuthenticationType { get; set; }
public ISecureDataFormat<AuthenticationProperties> StateDataFormat { get; set; }
}
}
Microsoft.Owin.Security.AuthenticationOptions: Microsoft.Owin.Security.AuthenticationOptions:
namespace Microsoft.Owin.Security
{
internal abstract class AuthenticationOptions
{
protected AuthenticationOptions(string authenticationType);
public AuthenticationMode AuthenticationMode { get; set; }
public string AuthenticationType { get; set; }
public AuthenticationDescription Description { get; set; }
}
}
The problem was that the AuthenticationOptions
class was set to internal. 问题是
AuthenticationOptions
类设置为internal。 I downgraded the Microsft.Owin.Security
package from 3.0.1 to 2.0.1. 我将
Microsft.Owin.Security
包从3.0.1降级到2.0.1。 Here the class is marked public
so I was able to compile without problems. 这里的类被标记为
public
因此我能够毫无问题地编译。
Thanks to Dmitry Rotay 感谢Dmitry Rotay
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.