本文整理汇总了C#中Kentor.AuthServices.Configuration.SPOptions类的典型用法代码示例。如果您正苦于以下问题:C# SPOptions类的具体用法?C# SPOptions怎么用?C# SPOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SPOptions类属于Kentor.AuthServices.Configuration命名空间,在下文中一共展示了SPOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SPOptions_ModulePath_RejectsNull
public void SPOptions_ModulePath_RejectsNull()
{
var subject = new SPOptions();
Action a = () => subject.ModulePath = null;
a.ShouldThrow<ArgumentNullException>().And.ParamName.Should().Be("value");
}
示例2: IdentityProvider
internal IdentityProvider(IdentityProviderElement config, SPOptions spOptions)
{
singleSignOnServiceUrl = config.SignOnUrl;
SingleLogoutServiceUrl = config.LogoutUrl;
EntityId = new EntityId(config.EntityId);
binding = config.Binding;
AllowUnsolicitedAuthnResponse = config.AllowUnsolicitedAuthnResponse;
metadataLocation = string.IsNullOrEmpty(config.MetadataLocation)
? null : config.MetadataLocation;
WantAuthnRequestsSigned = config.WantAuthnRequestsSigned;
DisableOutboundLogoutRequests = config.DisableOutboundLogoutRequests;
var certificate = config.SigningCertificate.LoadCertificate();
if (certificate != null)
{
signingKeys.AddConfiguredKey(
new X509RawDataKeyIdentifierClause(certificate));
}
foreach (var ars in config.ArtifactResolutionServices)
{
ArtifactResolutionServiceUrls[ars.Index] = ars.Location;
}
// If configured to load metadata, this will immediately do the load.
this.spOptions = spOptions;
LoadMetadata = config.LoadMetadata;
// Validate if values are only from config. If metadata is loaded, validation
// is done on metadata load.
if (!LoadMetadata)
{
Validate();
}
}
示例3: SPOptions_DecryptionCertificate_EmptyWhenOnlySigning
public void SPOptions_DecryptionCertificate_EmptyWhenOnlySigning()
{
var subject = new SPOptions();
subject.ServiceCertificates.Add(new ServiceCertificate { Use = CertificateUse.Signing, Certificate = SignedXmlHelper.TestCert2 });
subject.DecryptionServiceCertificates.Count.Should().Be(0);
}
示例4: SPOptions_Constructor_LoadsConfig
public void SPOptions_Constructor_LoadsConfig()
{
var config = KentorAuthServicesSection.Current;
config.AllowChange = true;
config.AuthenticateRequestSigningBehavior = SigningBehavior.Always;
config.Metadata.AllowChange = true;
config.Metadata.WantAssertionsSigned = true;
config.ValidateCertificates = true;
ISPOptions subject = new SPOptions(KentorAuthServicesSection.Current);
subject.ReturnUrl.Should().Be(config.ReturnUrl);
subject.MetadataCacheDuration.Should().Be(config.Metadata.CacheDuration);
subject.MetadataValidDuration.Should().Be(config.Metadata.ValidUntil);
subject.WantAssertionsSigned.Should().Be(true);
subject.ValidateCertificates.Should().Be(true);
subject.DiscoveryServiceUrl.Should().Be(config.DiscoveryServiceUrl);
subject.EntityId.Should().Be(config.EntityId);
subject.ModulePath.Should().Be(config.ModulePath);
subject.NameIdPolicy.AllowCreate.Should().Be(config.NameIdPolicyElement.AllowCreate);
subject.NameIdPolicy.Format.Should().Be(config.NameIdPolicyElement.Format);
subject.Organization.Should().Be(config.organization);
subject.AuthenticateRequestSigningBehavior.Should().Be(config.AuthenticateRequestSigningBehavior);
subject.RequestedAuthnContext.ClassRef.OriginalString.Should().Be("urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport");
subject.RequestedAuthnContext.Comparison.Should().Be(AuthnContextComparisonType.Minimum);
}
示例5: CreateSPOptions
internal static SPOptions CreateSPOptions()
{
var org = new Organization();
org.Names.Add(new LocalizedName("Kentor.AuthServices", CultureInfo.InvariantCulture));
org.DisplayNames.Add(new LocalizedName("Kentor AuthServices", CultureInfo.InvariantCulture));
org.Urls.Add(new LocalizedUri(
new Uri("http://github.com/KentorIT/authservices"),
CultureInfo.InvariantCulture));
var options = new SPOptions
{
EntityId = new EntityId("https://github.com/KentorIT/authservices"),
MetadataCacheDuration = new TimeSpan(0, 0, 42),
Organization = org,
DiscoveryServiceUrl = new Uri("https://ds.example.com"),
ReturnUrl = new Uri("https://localhost/returnUrl"),
};
options.SystemIdentityModelIdentityConfiguration.ClaimsAuthenticationManager
= new ClaimsAuthenticationManagerStub();
AddContacts(options);
AddAttributeConsumingServices(options);
return options;
}
示例6: CreateSPOptions
internal static SPOptions CreateSPOptions(Uri publicOrigin)
{
var org = new Organization();
org.Names.Add(new LocalizedName("Kentor.AuthServices", CultureInfo.InvariantCulture));
org.DisplayNames.Add(new LocalizedName("Kentor AuthServices", CultureInfo.InvariantCulture));
org.Urls.Add(new LocalizedUri(
new Uri("http://github.com/KentorIT/authservices"),
CultureInfo.InvariantCulture));
var options = new SPOptions
{
EntityId = new EntityId("https://github.com/KentorIT/authservices"),
MetadataCacheDuration = new TimeSpan(0, 0, 42),
MetadataValidDuration = TimeSpan.FromDays(24),
WantAssertionsSigned = true,
Organization = org,
DiscoveryServiceUrl = new Uri("https://ds.example.com"),
ReturnUrl = new Uri("https://localhost/returnUrl"),
PublicOrigin = publicOrigin
};
options.SystemIdentityModelIdentityConfiguration.ClaimsAuthenticationManager
= new ClaimsAuthenticationManagerStub();
options.SystemIdentityModelIdentityConfiguration.AudienceRestriction.AudienceMode
= AudienceUriMode.Never;
AddContacts(options);
AddAttributeConsumingServices(options);
return options;
}
示例7: LoadOptionsFromConfiguration
private static Options LoadOptionsFromConfiguration()
{
var spOptions = new SPOptions(KentorAuthServicesSection.Current);
var options = new Options(spOptions);
KentorAuthServicesSection.Current.IdentityProviders.RegisterIdentityProviders(options);
KentorAuthServicesSection.Current.Federations.RegisterFederations(options);
return options;
}
示例8: SPOptions_Saml2PSecurityTokenHandler_DefaultInstanceCreated
public void SPOptions_Saml2PSecurityTokenHandler_DefaultInstanceCreated()
{
var subject = new SPOptions
{
EntityId = new EntityId(entityId)
};
subject.Saml2PSecurityTokenHandler.Should().NotBeNull();
subject.Saml2PSecurityTokenHandler.Configuration.AudienceRestriction.AllowedAudienceUris
.Should().Contain(new Uri(entityId));
}
示例9: SPOptions_EntityId_SettingThrowsIfTokenHandlerCreated
public void SPOptions_EntityId_SettingThrowsIfTokenHandlerCreated()
{
var subject = new SPOptions
{
EntityId = new EntityId(entityId)
};
subject.Saml2PSecurityTokenHandler.Should().NotBeNull();
Action a = () => subject.EntityId = new EntityId(otherEntityId);
a.ShouldThrow<InvalidOperationException>("Can't change entity id when a token handler has been instantiated.");
}
示例10: KentorAuthServicesAuthenticationOptions
public KentorAuthServicesAuthenticationOptions(bool loadConfiguration)
: base(Constants.DefaultAuthenticationType)
{
AuthenticationMode = AuthenticationMode.Passive;
Description.Caption = Constants.DefaultCaption;
if (loadConfiguration)
{
SPOptions = new SPOptions(KentorAuthServicesSection.Current);
KentorAuthServicesSection.Current.IdentityProviders.RegisterIdentityProviders(this);
KentorAuthServicesSection.Current.Federations.RegisterFederations(this);
}
}
示例11: SetUp
public void SetUp()
{
spOptions = CreateSPOptions();
options = new Options(spOptions);
//Substitute.For<IOptions>();
options.IdentityProviders.Add(Idp());
//options.IdentityProviders.Returns(ReturnThis());
userService = Substitute.For<IUserService>();
underTest = new Saml2BearerGrantValidator(userService, options);
}
开发者ID:dariusdamalakas,项目名称:IdentityServer3.Saml2BearerGrant,代码行数:13,代码来源:Saml2BearerGrantValidator.cs
示例12: CreateSPOptions
private static SPOptions CreateSPOptions()
{
var spOptions = new SPOptions
{
EntityId = new EntityId(localMetaUri),
ReturnUrl = returnUrl,
WantAssertionsSigned = true
};
spOptions.ServiceCertificates.Add(new X509Certificate2(
AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "/App_Data/AzureApp_private_sha256.pfx","nomad_is_1593*"));
return spOptions;
}
示例13: Saml2PSecurityTokenHandler
public Saml2PSecurityTokenHandler(SPOptions spOptions)
{
if (spOptions == null)
{
throw new ArgumentNullException(nameof(spOptions));
}
Configuration = new SecurityTokenHandlerConfiguration
{
IssuerNameRegistry = new ReturnRequestedIssuerNameRegistry(),
AudienceRestriction = GetAudienceRestriction(spOptions),
SaveBootstrapContext = spOptions.SystemIdentityModelIdentityConfiguration.SaveBootstrapContext
};
}
示例14: AuthServicesUrls
public AuthServicesUrls(HttpRequestData request, SPOptions spOptions)
{
if (request == null)
{
throw new ArgumentNullException(nameof(request));
}
if (spOptions == null)
{
throw new ArgumentNullException(nameof(spOptions));
}
Init(request.ApplicationUrl, spOptions);
}
示例15: SPOptions_Constructor_LoadsConfig
public void SPOptions_Constructor_LoadsConfig()
{
var config = KentorAuthServicesSection.Current;
config.AllowChange(true);
config.AuthenticateRequestSigningBehavior = SigningBehavior.Always;
var subject = new SPOptions(KentorAuthServicesSection.Current);
subject.ReturnUrl.Should().Be(config.ReturnUrl);
subject.MetadataCacheDuration.Should().Be(config.MetadataCacheDuration);
subject.DiscoveryServiceUrl.Should().Be(config.DiscoveryServiceUrl);
subject.EntityId.Should().Be(config.EntityId);
subject.ModulePath.Should().Be(config.ModulePath);
subject.Organization.Should().Be(config.organization);
subject.AuthenticateRequestSigningBehavior.Should().Be(config.AuthenticateRequestSigningBehavior);
}