【问题标题】:Window Authentication in Linux .net coreLinux .net 核心中的窗口身份验证
【发布时间】:2022-01-27 15:52:06
【问题描述】:

我正在尝试使用 Kerberos 在 Linux/Debian 服务器中进行工作窗口身份验证。我正在使用 .net core 3.1 和 IdentityServer4。现在我已经将 Linux 加入了 Windows AD,就像文档说的那样: https://docs.microsoft.com/en-us/aspnet/core/security/authentication/windowsauth?view=aspnetcore-3.1&tabs=visual-studio#kestrel-1

我已经设法使用 -kinit 命令从 bash 中使用 kerberos。我还使用 kerberos 制作了 Apache2。

但在 .net 核心中,它总是在日志中返回 [17:39:53 信息] Microsoft.AspNetCore.Authentication.Negotiate.NegotiateHandler AuthenticationScheme:协商受到质疑。

[17:39:54 信息] Microsoft.AspNetCore.Authentication.Negotiate.NegotiateHandler 无

如果我在 krb5.conf 中设置了错误的加密类型,我会遇到如下错误:

Interop+NetSecurityNative+GssApiException:GSSAPI 操作失败并出现错误 - 未指定的 GSS 失败。次要代码可能提供更多信息(请求票证服务器 **** kvno 4 enctype aes256-cts 在 keytab 中找到但无法解密票证)。 在 System.Net.Security.NegotiateStreamPal.GssAcceptSecurityContext(SafeGssContextHandle& 上下文,Byte[] 缓冲区,Byte[]& outputBuffer,UInt32& outFlags) 在 System.Net.Security.NegotiateStreamPal.AcceptSecurityContext(SafeFreeCredentials credentialsHandle, SafeDeleteContext& securityContext, ContextFlagsPal requestedContextFlags, Byte[] incomingBlob, ChannelBinding channelBinding, Byte[]& resultBlob, ContextFlagsPal& contextFlags)

所以令牌在正常模式下传递 GSSAPI 并尝试验证用户,但 anwser 中总是有 None。有人可以帮我解决我做错了什么吗?

【问题讨论】:

  • 正如我所说,我猜我的状态是“无”。 if (errorCode == SecurityStatusPalErrorCode.OK || errorCode == SecurityStatusPalErrorCode.ContinueNeeded || errorCode == SecurityStatusPalErrorCode.CompleteNeeded) { status = BlobErrorType.None; } 所以,我的请求无法通过private byte[] GetOutgoingBlob(byte[] incomingBlob, out BlobErrorType status, out Exception error) 方法中的某些步骤。 github.com/dotnet/aspnetcore/blob/…

标签: linux windows asp.net-core authentication kerberos


【解决方案1】:

我通过使用[Authorize] 属性而不是HttpContext.ChallengeAsync() 得到它。

【讨论】:

    猜你喜欢
    • 2019-11-03
    • 2019-02-23
    • 1970-01-01
    • 2023-03-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-13
    • 2020-12-07
    相关资源
    最近更新 更多