Skip to content

Instantly share code, notes, and snippets.

@rbrayb
Created September 5, 2018 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rbrayb/aae853ff6ad0c0d5ef1a808c6cba4182 to your computer and use it in GitHub Desktop.
Save rbrayb/aae853ff6ad0c0d5ef1a808c6cba4182 to your computer and use it in GitHub Desktop.
Connecting two instances of IdentityServer 4 using the ComponentSpace SAML v2.0 for .NET Core and the Rock Solid Knowledge SAML v2.0 for .NET Core stack
// SAML client
new Client
{
ClientId = "https://IdentityServer4",
ClientName = "idsrv4 CS",
ProtocolType = IdentityServerConstants.ProtocolTypes.Saml2p,
AllowedScopes = {"openid", "profile"}
}
...
public static IEnumerable<ServiceProvider> GetServiceProviders()
{
return new[]
{
new ServiceProvider
{
EntityId = "https://IdentityServer4",
AssertionConsumerServices =
{new Service(SamlConstants.BindingTypes.HttpPost, "http://localhost:6000/SAML/AssertionConsumerService")},
SigningCertificates = {new X509Certificate2("sp.cer")}
}
};
}
"PartnerIdentityProviderConfigurations": [
{
"Description": "IdentityServer4-2",
"Name": "https://IdentityServer4-2",
"PartnerCertificates": [
{
"FileName": "certificates/idp.cer"
}
],
"SignAuthnRequest": true,
"SingleLogoutServiceUrl": "http://localhost:7000/SAML/SingleLogoutService",
"SingleSignOnServiceUrl": "http://localhost:7000/SAML/SingleSignOnService"
},
{
"Description": "IdentityServer4-RSK",
"Name": "http://localhost:5000",
"PartnerCertificates": [
{
"FileName": "certificates/idsrv3test.cer"
}
],
"SignAuthnRequest": true,
"SingleSignOnServiceUrl": "http://localhost:5000/saml/sso"
}
],
.AddSaml("idsrv4", "IdentityServer4", options =>
{
options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
options.SignOutScheme = IdentityServerConstants.SignoutScheme;
options.AssertionConsumerServicePath = "http://localhost:5000/saml/sso";
options.PartnerName = () => "http://localhost:5000";
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment