本文整理汇总了C#中IdentityProvider.CreateAuthenticateRequest方法的典型用法代码示例。如果您正苦于以下问题:C# IdentityProvider.CreateAuthenticateRequest方法的具体用法?C# IdentityProvider.CreateAuthenticateRequest怎么用?C# IdentityProvider.CreateAuthenticateRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IdentityProvider
的用法示例。
在下文中一共展示了IdentityProvider.CreateAuthenticateRequest方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IdentityProvider_CreateAuthenticateRequest_Destination
public void IdentityProvider_CreateAuthenticateRequest_Destination()
{
string idpUri = "http://idp.example.com/";
var ip = new IdentityProvider(new Uri(idpUri));
var r = ip.CreateAuthenticateRequest(null);
r.ToXElement().Attribute("Destination").Should().NotBeNull()
.And.Subject.Value.Should().Be(idpUri);
}
示例2: IdentityProvider_CreateAuthenticateRequest_DestinationInXml
public void IdentityProvider_CreateAuthenticateRequest_DestinationInXml()
{
string idpUri = "http://idp.example.com/";
var subject = new IdentityProvider(
new EntityId(idpUri),
Options.FromConfiguration.SPOptions)
{
SingleSignOnServiceUrl = new Uri(idpUri)
};
var r = subject.CreateAuthenticateRequest(null, StubFactory.CreateAuthServicesUrls());
r.ToXElement().Attribute("Destination").Should().NotBeNull()
.And.Subject.Value.Should().Be(idpUri);
}
示例3: IdentityProvider_MetadataLoadedConfiguredFromCode
public void IdentityProvider_MetadataLoadedConfiguredFromCode()
{
var spOptions = StubFactory.CreateSPOptions();
spOptions.ServiceCertificates.Add(new ServiceCertificate()
{
Certificate = SignedXmlHelper.TestCert
});
var subject = new IdentityProvider(
new EntityId("http://other.entityid.example.com"), spOptions)
{
MetadataLocation = "http://localhost:13428/idpMetadataOtherEntityId",
AllowUnsolicitedAuthnResponse = true
};
subject.AllowUnsolicitedAuthnResponse.Should().BeTrue();
subject.Binding.Should().Be(Saml2BindingType.HttpRedirect);
subject.EntityId.Id.Should().Be("http://other.entityid.example.com");
// If a metadatalocation is set, metadata loading is automatically enabled.
subject.LoadMetadata.Should().BeTrue();
subject.MetadataLocation.Should().Be("http://localhost:13428/idpMetadataOtherEntityId");
subject.MetadataValidUntil.Should().BeCloseTo(
DateTime.UtcNow.Add(MetadataRefreshScheduler.DefaultMetadataCacheDuration), precision: 100);
subject.SingleSignOnServiceUrl.Should().Be("http://wrong.entityid.example.com/acs");
subject.WantAuthnRequestsSigned.Should().Be(true, "WantAuthnRequestsSigned should have been loaded from metadata");
Action a = () => subject.CreateAuthenticateRequest(StubFactory.CreateAuthServicesUrls());
a.ShouldNotThrow();
}
示例4: IdentityProvider_CreateAuthenticateRequest_SigningBehaviorNever_OverridesIdpWantsRequestsSigned
public void IdentityProvider_CreateAuthenticateRequest_SigningBehaviorNever_OverridesIdpWantsRequestsSigned()
{
var options = StubFactory.CreateOptions();
var spOptions = options.SPOptions;
spOptions.AuthenticateRequestSigningBehavior = SigningBehavior.Never;
spOptions.ServiceCertificates.Add(new ServiceCertificate
{
Certificate = SignedXmlHelper.TestCert
});
var subject = new IdentityProvider(new EntityId("http://idp.example.com"), spOptions)
{
WantAuthnRequestsSigned = true
};
var urls = StubFactory.CreateAuthServicesUrls();
var actual = subject.CreateAuthenticateRequest(urls).SigningCertificate;
actual.Should().BeNull();
}
示例5: InitiateLoginToIdp
private static CommandResult InitiateLoginToIdp(IOptions options, IDictionary<string, string> relayData, AuthServicesUrls urls, IdentityProvider idp, Uri returnUrl)
{
var authnRequest = idp.CreateAuthenticateRequest(urls);
options.Notifications.AuthenticationRequestCreated(authnRequest, idp, relayData);
var commandResult = idp.Bind(authnRequest);
commandResult.RequestState = new StoredRequestState(
idp.EntityId, returnUrl, authnRequest.Id, relayData);
commandResult.SetCookieName = "Kentor." + authnRequest.RelayState;
options.Notifications.SignInCommandResultCreated(commandResult, relayData);
return commandResult;
}
示例6: IdentityProvider_MetadataLoadedConfiguredFromCode
public void IdentityProvider_MetadataLoadedConfiguredFromCode()
{
var subject = new IdentityProvider(
new EntityId("http://other.entityid.example.com"),
StubFactory.CreateSPOptions())
{
MetadataUrl = new Uri("http://localhost:13428/idpMetadataOtherEntityId"),
AllowUnsolicitedAuthnResponse = true
};
subject.AllowUnsolicitedAuthnResponse.Should().BeTrue();
subject.Binding.Should().Be(Saml2BindingType.HttpRedirect);
subject.EntityId.Id.Should().Be("http://other.entityid.example.com");
// If a metadatalocation is set, metadata loading is automatically enabled.
subject.LoadMetadata.Should().BeTrue();
subject.MetadataUrl.OriginalString.Should().Be("http://localhost:13428/idpMetadataOtherEntityId");
subject.MetadataValidUntil.Should().BeCloseTo(
DateTime.UtcNow.Add(MetadataRefreshScheduler.DefaultMetadataCacheDuration));
subject.SingleSignOnServiceUrl.Should().Be("http://wrong.entityid.example.com/acs");
Action a = () => subject.CreateAuthenticateRequest(null, StubFactory.CreateAuthServicesUrls());
a.ShouldNotThrow();
}