Tag: shibboleth

使用Shibboleth进行asp.net MVC身份validation

Shibboleth是一种SSO身份validation,它作为“插件”添加到IIS中。 在用户完成登录后,会出现显示Shibboleth会话的标题:ShibSessionID ShibIdentityProvider eppn从属关系权利unscopedaffiliation …更多 所以我可以从标题中提取用户名和角色。 到目前为止一切都很好 问题:如何实现读取标头并设置用户授权状态的处理程序? 想法是使用[Authorize]属性和Method Roles.IsUserInRole。 全部来自Headers,没有数据库,没有用户管理。 更新 实施根据@Pharylon的回答 在这个更新中没有什么新东西,只是副本和过去的朋友的帮助。 当然,您必须根据Shibboleth设置调整属性和标题字段名称。 文件:ShibbolethPrincipal.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Security.Principal; //GenericPrincipal namespace Shibboleth { public class ShibbolethPrincipal : GenericPrincipal { public string username { get { return this.Identity.Name.Replace(“@ksz.ch”, “”); } } public string firstname { get { return HttpContext.Current.Request.Headers[“givenName”]; […]