我使用此代码
创建了login.ashx处理程序public void ProcessRequest(HttpContext context)
{
var handler = new dk.nita.saml20.protocol.Saml20SignonHandler();
handler.ProcessRequest(context);
}
我被重定向到登录表单,我在其中插入了用户名和密码。之后,我被重定向回我的网络应用程序,但dk.nita.saml20.identity.Saml20Identity.Current
为空..
我使用SAML Tracer来显示SAMLResponse,一切看起来都不错。好像我错过了一些东西。我的应用程序不处理SAML响应。我做错了什么?
我已将Federation和SAML20Federation部分添加到web.config。
这是我的联邦部分
<Federation xmlns="urn:dk.nita.saml20.configuration">
<SigningCertificate findValue="CN=WORK-PC" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectDistinguishedName" validonly="no"/>
<!-- The list of allowed audiences must at least contain the id of the service provider. -->
<AllowedAudienceUris>
<Audience>5F73859A-EDFF-47A8-B348-D46C9ED34C2B</Audience>
</AllowedAudienceUris>
</Federation>
<SAML20Federation xmlns="urn:dk.nita.saml20.configuration">
<ShowError>true</ShowError>
<ServiceProvider id="5F73859A-EDFF-47A8-B348-D46C9ED34C2B" server="https://fed-lab.aaiedu.hr/">
<ServiceEndpoint localpath="login.ashx" type="signon" redirectUrl="http://localhost:12771/logout" index="0"/>
<ServiceEndpoint localpath="logout.ashx" type="logout" redirectUrl="Home.aspx" index="1"/>
<ServiceEndpoint localpath="metadata.ashx" type="metadata"/>
<md:ContactPerson contactType="administrative" xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata">
<md:Company>Demo</md:Company>
<md:GivenName>Ivan</md:GivenName>
<md:SurName>Horvat</md:SurName>
<md:EmailAddress>email@demo.hr</md:EmailAddress>
<md:TelephoneNumber>1111111</md:TelephoneNumber>
</md:ContactPerson>
<NameIDFormats all="true"/>
</ServiceProvider>
<RequestedAttributes>
<!-- The attributes that the demonstration identity provider issues. -->
<att name="urn:FirstName" isRequired="true"/>
<att name="urn:LastName" isRequired="true"/>
<att name="urn:Age"/>
</RequestedAttributes>
<IDPEndPoints metadata="C:\metadata\">
<add id="https://fed-lab.aaiedu.hr/ms/saml2/idp/metadata.php">
<CertificateValidation>
<add type="dk.nita.saml20.Specification.SelfIssuedCertificateSpecification, dk.nita.saml20"/>
</CertificateValidation>
</add>
</IDPEndPoints>
</SAML20Federation>
和我的系统网络
<authentication mode="Forms">
<forms cookieless="UseCookies" loginUrl="login.ashx" name="ServiceProvider"/>
</authentication>