这些是用于Microsoft服务单点登录的众多技术和流行语.
有人可以解释ADFS,WIF,WS联合,SAML和STS(安全令牌服务),包括每个使用的位置和时间.
我正在尝试创建类似的东西:客户端验证并从自定义STS1获取令牌,下一个客户端使用机器密钥授权并在自定义STS2上获得令牌并获取另一个令牌.使用最后一个令牌,客户端请求RP服务上的方法.
所有服务都托管在IIS上,并且正在使用活动联合方案.两个STS都有ws2007Federation和ws2007Http绑定的端点,RP使用ws2007FederationBinding和STS2作为发行者.
如果我使用CreateChannelWithIssuedToken创建通道,我只能看到来自STS1的令牌,并且无法从STS2获取令牌.
所以我决定将STS1中的令牌作为ActAs RST的属性传递给STS2令牌.那失败了 - 无法解密令牌.
我最近开始研究新的ASP.Net Identity框架和Katana中间件,那里有大量的代码和文档,但我看到的是很多相互矛盾的信息,我想这是一个代码更新频率增加的结果.
我期待使用WsFederation认证与内部ADFS分2次服,但方式OWIN认证管道工程有我有点困惑,我希望有人能提供一些确切的信息.
具体来说,我感兴趣的是应该连接中间件的顺序以及在各种场景中需要哪些模块,我想摆脱任何不需要的东西,同时确保过程尽可能安全.
例如,它似乎UseWsFederationAuthentication应该与之结合使用UseCookieAuthentication,但我不确定正确的AuthenticationType是什么(这篇帖子暗示它只是一个标识符字符串,但它的值是否显着?)或者即使我们仍然需要用SetDefaultSignInAsAuthenticationType.
我还注意到Katana项目讨论板上的这个帖子,Tratcher在那里提到了一个常见的错误,但是对于哪部分代码出错是不是很具体.
就个人而言,我现在使用以下(使用自定义SAML令牌处理程序将令牌字符串读入有效的XML文档),它对我有用,但它是否最佳?
var appURI = ConfigurationManager.AppSettings["app:URI"];
var fedPassiveTokenEndpoint = ConfigurationManager.AppSettings["wsFederation:PassiveTokenEndpoint"];
var fedIssuerURI = ConfigurationManager.AppSettings["wsFederation:IssuerURI"];
var fedCertificateThumbprint = ConfigurationManager.AppSettings["wsFederation:CertificateThumbprint"];
var audienceRestriction = new AudienceRestriction(AudienceUriMode.Always);
audienceRestriction.AllowedAudienceUris.Add(new Uri(appURI));
var issuerRegistry = new ConfigurationBasedIssuerNameRegistry();
issuerRegistry.AddTrustedIssuer(fedCertificateThumbprint, fedIssuerURI);
app.UseCookieAuthentication(
new CookieAuthenticationOptions
{
AuthenticationType = WsFederationAuthenticationDefaults.AuthenticationType // "Federation"
}
);
app.UseWsFederationAuthentication(
new WsFederationAuthenticationOptions
{
Wtrealm = appURI,
SignOutWreply = appURI,
Configuration = new WsFederationConfiguration
{
TokenEndpoint = fedPassiveTokenEndpoint …Run Code Online (Sandbox Code Playgroud) 我正在使用Owin配置我的ASP.NET MVC 5(.NET 4.5,IIS 7/8)应用程序以对第三方ADFS设置进行身份验证:
app.SetDefaultSignInAsAuthenticationType(WsFederationAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = WsFederationAuthenticationDefaults.AuthenticationType
});
app.UseWsFederationAuthentication(new WsFederationAuthenticationOptions
{
Wtrealm = Settings.Auth.Wtrealm,
MetadataAddress = Settings.Auth.MetadataAddress
});
Run Code Online (Sandbox Code Playgroud)
我还有一个自定义身份验证过滤器(与之配合使用AuthorizeAttribute):
public class OwinAuthenticationAttribute : ActionFilterAttribute, IAuthenticationFilter
{
public void OnAuthentication(AuthenticationContext filterContext)
{
var user = filterContext.RequestContext.HttpContext.User;
var authenticated = user.Identity.IsAuthenticated;
if (!authenticated)
{
return;
}
/* Redirect to profile setup if not already complete */
}
public void OnAuthenticationChallenge(AuthenticationChallengeContext filterContext)
{
}
}
Run Code Online (Sandbox Code Playgroud)
这种方法在一半的时间内工作正常,但有时,在初始登录时,应用程序和ADFS登录之间将发生重定向循环.这似乎是特定于会话的(并非所有用户同时发生),并且一旦发生重定向循环,它似乎会继续发生,直到应用程序池刷新.
当重定向循环发生时,我仍然可以看到(在Chrome的"网络"标签中)看起来像ADFS发布的有效令牌.
我很难分离根本原因但我发现的是 - 当循环没有发生时,user.Identity是类型ClaimsIdentity而且IsAuthenticated是 …
您好,我一直在尝试在我的MVC6 Web应用程序上实现WS-Fed SSO,我已经阅读了一些关于身份验证的内容以及所有来确定我的要求.我必须使用WsFederationAuth,所以没有oauth或saml协议对我有用.
编辑:在@Pinpoint建议之后我尝试使用owin中间件来实现连接,但是我将使用完整的框架DNX451而不是DNXCore,但它等待Vnext支持ws-fed.
public static class AppBuilderExtensions
{
#if !DNXCORE50
public static IApplicationBuilder UseOwinAppBuilder(this IApplicationBuilder app,
Action<IAppBuilder> configuration)
{
if (app == null)
{
throw new ArgumentNullException(nameof(app));
}
if (configuration == null)
{
throw new ArgumentNullException(nameof(configuration));
}
return app.UseOwin(setup => setup(next =>
{
var builder = new AppBuilder();
var lifetime = (IApplicationLifetime) app.ApplicationServices.GetService(typeof (IApplicationLifetime));
var properties = new AppProperties(builder.Properties);
properties.AppName = app.ApplicationServices.GetApplicationUniqueIdentifier();
properties.OnAppDisposing = lifetime.ApplicationStopping;
properties.DefaultApp = next;
configuration(builder);
return builder.Build<Func<IDictionary<string, object>, Task>>(); …Run Code Online (Sandbox Code Playgroud) 方案如下:我需要对用户(使用他的大学帐户)执行联盟身份验证到他的大学的Sharepoint站点,并获得FedAuth和rtFa cookie(我必须将其传递给SharePoint REST webservices)为了访问资源).
我做了一些尝试,但每个问题至少有一个问题:
ClientContext context = new ClientContext(host);
SharePointOnlineCredentials creds = new SharePointOnlineCredentials(user, passw);
context.Credentials = creds;
Uri sharepointuri = new Uri(host);
string authCookie = creds.GetAuthenticationCookie(sharepointuri);
Web web = context.Web;
context.Load(web, w=>w.Lists);
context.ExecuteQuery();
fedAuthString = authCookie.Replace("SPOIDCRL=", string.Empty);
Run Code Online (Sandbox Code Playgroud)
这样我设法获得FedAuth cookie,但我无法获得rtFa cookie.
我怎么能在这一点上获得rtFa cookie?我是否可以拦截此类操作中涉及的HTTP请求(即context.ExecuteQuery()) - 其中可能包含标题中的rtFa cookie?或者,我是否可以通过仅利用FedAuth cookie来获取rtFa cookie?
这是一个帮助类,可以在Internet上找到(例如,这里http://blog.kloud.com.au/tag/msonlineclaimshelper/).
该类实际上与普通身份验证一起使用,但在联合身份验证时失败.
所以我调整它以使它在这种情况下工作.只要我理解,步骤如下:
我不是这方面的专家,我提出以下代码:
这是调用上述方法的代码,并尝试通过两个步骤从凭证中获取FedAuth和rtFa(步骤1:从联合方获取SAML令牌;步骤2:将令牌从联合方传递到Sharepoint):
private List<string> GetCookies(){ …Run Code Online (Sandbox Code Playgroud) c# authentication sharepoint claims-based-identity ws-federation
我一直在使用WIF来验证我们的新网站,STS基于starter-sts实现.
为了使其在负载均衡环境中正常工作,我在global.asax中使用了以下内容来覆盖默认的证书行为.
void onServiceConfigurationCreated(object sender, ServiceConfigurationCreatedEventArgs e)
{
List<CookieTransform> sessionTransforms = new List<CookieTransform>(new CookieTransform[]
{
new DeflateCookieTransform(),
new RsaEncryptionCookieTransform(e.ServiceConfiguration.ServiceCertificate),
new RsaSignatureCookieTransform(e.ServiceConfiguration.ServiceCertificate)
});
SessionSecurityTokenHandler sessionHandler = new SessionSecurityTokenHandler(sessionTransforms.AsReadOnly());
e.ServiceConfiguration.SecurityTokenHandlers.AddOrReplace(sessionHandler);
}
Run Code Online (Sandbox Code Playgroud)
这一切都正常工作,人们已成功使用该系统,但不时我们得到一个爆炸:
ID1014:签名无效.数据可能已被篡改.
在事件日志中,所以我打开了WIF跟踪,并在日志中看到了以下提到的内容.
ID1074:尝试使用ProtectedData API加密cookie时发生CryptographicException(有关详细信息,请参阅内部异常).如果您使用的是IIS 7.5,则可能是由于应用程序池上的loadUserProfile设置被设置为false.
我有一种感觉,正如我想的那样,这导致我走入一条黑暗的小巷,因为我改变了使用RSA的实现,这不应该影响我.
有什么想法可以帮到我吗?
我用.NET 4.5创建了一个新的ASP.NET MVC应用程序.我已成功使用STS设置身份验证.身份验证流程正常,我可以在Thread.CurrentPrincipal上获取包含所需声明的ClaimsIdentity.
现在我需要引导令牌来保护对我的服务层的调用.我在identityConfiguration元素上将saveBootstrapContext设置为true.
<system.identityModel>
<identityConfiguration saveBootstrapContext="true">
Run Code Online (Sandbox Code Playgroud)
但是,ClaimsIdentity上的BootstrapContext属性始终为null.
var identity = Thread.CurrentPrincipal.Identity as ClaimsIdentity;
var context = identity.BootstrapContext; // context is always null
Run Code Online (Sandbox Code Playgroud)
我在这里错过了什么吗?这被认为是直截了当的:(
- - - - - - 解决 - - - - - -
重新启动系统后,此问题已得到解决.请注意,在iisreset之后它没有解决.后来我更改了配置以使用Microsoft.IdentityModel而不是System.IdentityModel.我能够重现这种行为.再次重启后,我又能够再次获得引导令牌.其他人有同样的行为吗?
asp.net-mvc claims-based-identity wif ws-federation .net-4.5
我正在尝试为签名的WS-Federation令牌实现一个断言消费者,作为SSO系统的一部分.我知道simplesamlphp有(未记录的)ws-fed支持,但我使用的是Django堆栈.看起来djangosaml2 pysaml2不支持WS-Federation规范,因为它们期望XML具有"Response"根节点,而不是"RequestSecurityTokenResponseCollection"根节点.
有没有人遇到过这个?有没有可以帮助我的python库?我很想吸引自己的消费者,但由于缺乏X509和xml知识,我担心我可能会因为缺乏X509和xml知识而导致安全漏洞.
谢谢!
对于我的公司,我必须制作一个POC来检查我们是否可以对我们的项目使用wsFederation身份验证,该项目有一个MVC应用程序,一些webapi控制器和一些signalR集线器,所有这些都在不同的项目中.我们还希望在客户端应用程序和身份提供商应用程序中使用OWIN身份验证中间件.
我使用Thinktecture Identity Server v2作为身份提供者的开始(但我们必须在某些时候开发自己).对于MVC应用程序,它非常直接,并且使用SAML2令牌工作正常.
但是现在事情变得有点复杂,因为我希望Web应用程序上的经过身份验证的用户能够使用ajax调用从web api应用程序(与MVC不同,请记住)调用控制器方法.
我已经阅读了许多关于委托和代理令牌的事情,但我有点迷失,不知道在哪里或如何开始这部分.此外,我找不到任何关于使用OWIN身份验证的委派.
所以我的第一个问题是:是否有可能实现这一目标?然后:有人能指出我正确的方向吗?
ws-federation ×10
c# ×4
wif ×4
adfs ×3
owin ×3
asp.net-mvc ×2
saml ×2
.net ×1
.net-4.5 ×1
asp.net ×1
asp.net-core ×1
django ×1
identity ×1
katana ×1
python ×1
sharepoint ×1
wcf ×1
ws-security ×1