- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试为 Intranet(基于 Orchard CMS)对 Azure AD 和 Graph 进行身份验证,这在我的本地计算机上按预期运行,但是,当访问将成为生产站点的内容时(已经在 ssl 上设置) our internal dns), 我有时会出现上述错误,它相对不一致,我部门的其他人在访问时通常会出现此错误。
我的认证 Controller 如下:
public void LogOn()
{
if (!Request.IsAuthenticated)
{
// Signal OWIN to send an authorization request to Azure.
HttpContext.GetOwinContext().Authentication.Challenge(
new AuthenticationProperties { RedirectUri = "/" },
OpenIdConnectAuthenticationDefaults.AuthenticationType);
}
}
public void LogOff()
{
if (Request.IsAuthenticated)
{
ClaimsPrincipal _currentUser = (System.Web.HttpContext.Current.User as ClaimsPrincipal);
// Get the user's token cache and clear it.
string userObjectId = _currentUser.Claims.First(x => x.Type.Equals(ClaimTypes.NameIdentifier)).Value;
SessionTokenCache tokenCache = new SessionTokenCache(userObjectId, HttpContext);
HttpContext.GetOwinContext().Authentication.SignOut(OpenIdConnectAuthenticationDefaults.AuthenticationType, CookieAuthenticationDefaults.AuthenticationType);
}
SDKHelper.SignOutClient();
HttpContext.GetOwinContext().Authentication.SignOut(
OpenIdConnectAuthenticationDefaults.AuthenticationType, CookieAuthenticationDefaults.AuthenticationType);
}
我的openid选项配置如下:
AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimTypes.NameIdentifier;
var openIdOptions = new OpenIdConnectAuthenticationOptions
{
ClientId = Settings.ClientId,
Authority = "https://login.microsoftonline.com/common/v2.0",
PostLogoutRedirectUri = Settings.LogoutRedirectUri,
RedirectUri = Settings.LogoutRedirectUri,
Scope = "openid email profile offline_access " + Settings.Scopes,
TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer = false,
},
Notifications = new OpenIdConnectAuthenticationNotifications
{
AuthorizationCodeReceived = async (context) =>
{
var claim = ClaimsPrincipal.Current;
var code = context.Code;
string signedInUserID = context.AuthenticationTicket.Identity.FindFirst(ClaimTypes.NameIdentifier).Value;
TokenCache userTokenCache = new SessionTokenCache(signedInUserID,
context.OwinContext.Environment["System.Web.HttpContextBase"] as HttpContextBase).GetMsalCacheInstance();
ConfidentialClientApplication cca = new ConfidentialClientApplication(
Settings.ClientId,
Settings.LogoutRedirectUri,
new ClientCredential(Settings.AppKey),
userTokenCache,
null);
AuthenticationResult result = await cca.AcquireTokenByAuthorizationCodeAsync(code, Settings.SplitScopes.ToArray());
},
AuthenticationFailed = (context) =>
{
context.HandleResponse();
context.Response.Redirect("/Error?message=" + context.Exception.Message);
return Task.FromResult(0);
}
}
};
var cookieOptions = new CookieAuthenticationOptions();
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(cookieOptions);
app.UseOpenIdConnectAuthentication(openIdOptions);
重定向 url 在 apps.dev.microsoft.com 和我们的本地化 Web 配置中保持一致。
最佳答案
就我而言,这是一个非常奇怪的问题,因为它并没有发生在每个人身上,只有少数客户和开发人员遇到过这个问题。
如果您仅在 chrome(或具有相同引擎的浏览器)中遇到此问题,您可以尝试将 chrome 上的此标志设置为禁用。
这里发生的是 chrome 具有不同的安全规则,即“如果没有 SameSite 限制的 cookie 设置为没有 Secure 属性,它将被拒绝”。因此,您可以禁用此规则,它会起作用。
或者,您也可以设置 Secure 属性,但我不知道该怎么做;(
关于c# - IDX21323 OpenIdConnectProtocolValidationContext.Nonce 为空,OpenIdConnectProtocolValidatedIdToken.Payload.Nonce 不为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49944071/
几年前,我在 stackoverflow 上询问过如何使 PHP 密码存储安全。main answer建议使用以下哈希算法: function hash_password($password, $no
当我创建自己的模板时,我了解使用随机数的过程。 但是我正在开发一个仅使用 Wordpress REST API 来提取数据的 ReactJS 应用程序,因此用户永远不会访问 index.php,而是对
我正在尝试为 Intranet(基于 Orchard CMS)对 Azure AD 和 Graph 进行身份验证,这在我的本地计算机上按预期运行,但是,当访问将成为生产站点的内容时(已经在 ssl 上
到目前为止,当使用 API 进行身份验证时,我已经使用它来生成一个简单的 nonce: def nonce(): return str(int(time.time()) * 1000) It
我在尝试向服务器发送 soap 请求 (soapCall) 时遇到错误。 Fatal error: Uncaught SoapFault exception: [ns1:InvalidSecurity
我的设置是: Laravel 4.2 Braintreepayments JS + PHP Laravel Braintree 我试图添加一个新客户 as showed in the tutorial
我正在尝试将 nonce 值添加到我的内联脚本中以满足更严格的 CSP。但是,我遇到了一个奇怪的问题,即 chrome 正在从 nonce 属性中剥离值。当我 curl 页面时,会出现 nonce 值
我正在服务器端编写 OAuth 协议(protocol)的提供者部分,并且我正在研究我需要缓存的 OAuth 消费者发送的随机数。 根据推特的文档, Twitter will only allow a
我使用 web3 和供应商主网。我按契约(Contract)进行了 2 笔交易。首先是批准方法,另一笔交易是多次转账。我将第二个签名存储在数据库中。如果第一笔交易成功,我发送第二笔交易/。第二个事务几
我在我的 nuxtjs 项目中使用了 nuxt-auth。 enter image description here 最佳答案 您需要将responseType指定为“token id_token”:
我在通过 ajax 请求进行基本随机数验证时遇到问题。 这些是我的脚本加载器和 css 加载器函数: (在gallery.php中) function gallery_js_loader() {
我在我的 nuxtjs 项目中使用了 nuxt-auth。 enter image description here 最佳答案 您需要将responseType指定为“token id_token”:
我正在尝试向 Square 提交付款,但不确定 card_nonce 代表什么。 在此处找到的完整 API 文档:https://docs.connect.squareup.com/api/conne
嗨,有人可以帮助我在调用 outlook rest api 时遇到以下错误吗 IDX21323:RequireNonce 是“[PII 默认隐藏。将 IdentityModelEventSource.
我对随机数的理解很模糊,但有点困惑。 nonce 验证失败时的正确响应是什么? 在什么情况下 nonce 验证会失败?对真正的用户有什么风险? 最佳答案 表单随机数的目标通常有两个:确保数据只提交一次
我不确定我是否理解正确:消息计数器可以用作/代替 nonce? 我的意思是这样的消息: Header(2bytes) | counter(8bytes) | Body(n bytes encrypte
我正在开发一种软件,其中使用带有 Oauth2 的 Microsoft Azure AD 完成登录过程。随机数在此过程中是可选的,成功登录后我会收到一个有效期为一小时的 token 。 我无法理解
除了随机的 30 个字符的字母数字字符串作为我的 nonce 之外,我真的可以让我的请求更安全吗? 最佳答案 实际上,尽管 RFC 说“随机字符串”,但随机数不一定是随机的。它必须是独一无二的。 使用
我已经构建了一个自定义的 WooCommerce 购物车,您可以在其中使用 AJAX 更改数量和/或从购物车中删除项目,但它有问题,我认为这与 WooCommerce 和 WordPress nonc
这个问题here是关于创建一个身份验证方案。 AviD 给出的接受答案指出 Your use of a cryptographic nonce is also important, that many
我是一名优秀的程序员,十分优秀!