public void AddMyCoolWebsiteRelyingPartyWithSamlTokenDetails() { var encryptionCert = new X509Certificate(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "testCert.cer")); var signingCertBytes = this.ReadBytesFromPfxFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "testCert_xyz.pfx")); var temp = new X509Certificate2(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "testCert_xyz.pfx"), "xyz"); var startDate = temp.NotBefore.ToUniversalTime(); var endDate = temp.NotAfter.ToUniversalTime(); var acsNamespace = new AcsNamespace(this.namespaceDesc); acsNamespace.AddRelyingParty( rp => rp .Name("MyCoolWebsite") .RealmAddress("http://mycoolwebsite.com/") .ReplyAddress("http://mycoolwebsite.com/") .AllowGoogleIdentityProvider() .AllowWindowsLiveIdentityProvider() .SamlToken() .TokenLifetime(120) .SigningCertificate(sc => sc.Bytes(signingCertBytes).Password("xyz").StartDate(startDate).EndDate(endDate)) .EncryptionCertificate(encryptionCert.GetRawCertData())); acsNamespace.SaveChanges(); Assert.IsTrue(AcsHelper.CheckRelyingPartyExists(this.namespaceDesc, "MyCoolWebsite")); Assert.IsTrue(AcsHelper.CheckRelyingPartyHasKeys(this.namespaceDesc, "MyCoolWebsite", 2)); }
public void AddMyCoolWebsiteRelyingPartyWithSamlTokenDetailsWithX509CertificateFromCertificateStore() { var acsNamespace = new AcsNamespace(this.namespaceDesc); acsNamespace.AddRelyingParty( rp => rp .Name("MyCoolWebsite with X509") .RealmAddress("http://mycoolwebsitewithx509.com/") .ReplyAddress("http://mycoolwebsitewithx509.com/") .AllowGoogleIdentityProvider() .EncryptionCertificateIdentifiedBy(thumbprint: "66e0bc68570e30fba6207b1050ac72dc5b48cf47")); acsNamespace.SaveChanges(); Assert.IsTrue(AcsHelper.CheckRelyingPartyExists(this.namespaceDesc, "MyCoolWebsite with X509")); Assert.IsTrue(AcsHelper.CheckRelyingPartyHasKeys(this.namespaceDesc, "MyCoolWebsite with X509", 1)); }
public void AddMyCoolWebsiteRelyingPartyWithSamlTokenDetailsWithX509CertificateFromFile() { var encryptionCert = new X509Certificate(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "testCert.cer")); var acsNamespace = new AcsNamespace(this.namespaceDesc); acsNamespace.AddRelyingParty( rp => rp .Name("MyCoolWebsite with X509") .RealmAddress("http://mycoolwebsitewithx509.com/") .ReplyAddress("http://mycoolwebsitewithx509.com/") .AllowGoogleIdentityProvider() .EncryptionCertificate(encryptionCert)); acsNamespace.SaveChanges(); Assert.IsTrue(AcsHelper.CheckRelyingPartyExists(this.namespaceDesc, "MyCoolWebsite with X509")); Assert.IsTrue(AcsHelper.CheckRelyingPartyHasKeys(this.namespaceDesc, "MyCoolWebsite with X509", 1)); }
public void AddMyCoolWebsiteRelyingPartyWithSwtTokenDetails() { var acsNamespace = new AcsNamespace(this.namespaceDesc); acsNamespace.AddRelyingParty( rp => rp .Name("MyCoolWebsite") .RealmAddress("http://mycoolwebsite.com/") .ReplyAddress("http://mycoolwebsite.com/") .AllowGoogleIdentityProvider() .AllowWindowsLiveIdentityProvider() .SwtToken() .TokenLifetime(120) .SymmetricKey(Convert.FromBase64String("yMryA5VQVmMwrtuiJBfyjMnAJwoT7//fCuM6NwaHjQ1="))); acsNamespace.SaveChanges(); Assert.IsTrue(AcsHelper.CheckRelyingPartyExists(this.namespaceDesc, "MyCoolWebsite")); Assert.IsTrue(AcsHelper.CheckRelyingPartyHasKeys(this.namespaceDesc, "MyCoolWebsite", 1)); }