asp.net - ADFS 单点登录不适用于会话状态模式“UserUri”
问题描述
我们的 asp.net 网站在 ADFS SSO 上运行良好,因为我们将会话状态 cookie 设置从“使用 Cookie”更改为“使用 URI”。进行此更改后,以下代码中的 fam.IsSignInResponse(request) 始终为 false,因此它递归地重定向回 ADFS 登录屏幕。
public List<ClaimEntity> GetClaims()
{
logger.Info("Started executing GetClaims()");
List<ClaimEntity> claims = new List<ClaimEntity>();
// sam is configured in web.config
var sam = FederatedAuthentication.SessionAuthenticationModule;
logger.Info("Declaring sam");
// fam is not
var fam = new WSFederationAuthenticationModule();
logger.Info("Declaring fam");
//fam.FederationConfiguration = FederatedAuthentication.FederationConfiguration;
fam.ServiceConfiguration = FederatedAuthentication.ServiceConfiguration;
logger.Info("Assigning ServiceConfiguration to fam");
var request = thisContext.Request;
// is this the response from the STS
if (!fam.IsSignInResponse(request))
{
// no
logger.Info("fam.IsSignInResponse => No");
// the STS
fam.Issuer = _IssuerSTSSpec.Issuer;
logger.Info("IssuerUrl= " + _IssuerSTSSpec.Issuer);
// the return address
fam.Realm = thisContext.Request.Url.AbsoluteUri;
logger.Info("Assigning fam.Realm= " + thisContext.Request.Url.AbsoluteUri);
logger.Info("Creating SignInRequest...");
var req = fam.CreateSignInRequest(string.Empty, null, false);
logger.Info("Redirecting to the issuer...");
logger.Info("Request to STS: "+ req.WriteQueryString().ToString());
// go to STS
thisContext.Response.Redirect(req.WriteQueryString());
}
else
{
// yes
-----------
-----------
}
logger.Info("Returning the claims");
return claims;
}
ADFS 集成应用程序是否不支持“使用 URI”会话 cookie 模式或我的代码需要进行任何更改?
解决方案
如果您添加“使用URI”的示例代码将有助于更好地理解。真的有必要使用这种方法吗?使用 cookie 将保持 URL 干净并且更易于管理。如果它已经为您工作,您可以使用它,除非确实需要使用 URI
推荐阅读
- javascript - 静态函数不是函数javascript
- python - 仅当 25% 分位数高于给定值时才选择数据
- xpath - xpath - 如何从 Quora 中的节点获取文本?
- sitecore-sxa - Sitecore-SXA 搜索结果和方面
- post - 带参数的 Axios Vuejs POST 请求
- javascript - 在 JavaScript 对象中制作重复动画循环
- hdfs - Pig 无法创建 .bz2 文件但创建 .deflate 文件
- node.js - 从 Buffer node.js 前面移除元素
- html - 内文本的 CSS 选择器
- 元素(定义列表标签)
- vba - 如何将单元格值分成多个单元格(名称、街道、城市、州、邮编)