Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Break out Metadata to separate library #1182

Merged
merged 4 commits into from
Apr 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Sustainsys.Saml2.Metadata/AdditionalMetadataLocation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;

namespace Sustainsys.Saml2.Metadata
{
public class AdditionalMetadataLocation
{
public Uri Uri { get; set; }

public string Namespace { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ namespace Sustainsys.Saml2.Metadata
{
public class AttributeProfile
{
public Uri Uri { get; set; }
public Uri Uri { get; set; }
}
}
}
9 changes: 9 additions & 0 deletions Sustainsys.Saml2.Metadata/CipherData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Sustainsys.Saml2.Metadata
{
public class CipherData
{
public string CipherValue { get; set; }

public CipherReference CipherReference { get; set; }
}
}
15 changes: 15 additions & 0 deletions Sustainsys.Saml2.Metadata/CipherReference.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Xml;

namespace Sustainsys.Saml2.Metadata
{
public class CipherReference
{
public Uri Uri { get; set; }

public ICollection<XmlElement> Transforms { get; private set; } =
new Collection<XmlElement>();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Xml;

namespace Sustainsys.Saml2.Configuration
namespace Sustainsys.Saml2.Metadata.Configuration
{
interface ICustomIdentityConfiguration
{
Expand Down
55 changes: 55 additions & 0 deletions Sustainsys.Saml2.Metadata/ConstrainedValue.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Xml;

namespace Sustainsys.Saml2.Metadata
{
public class ClaimValue
{
public string Value { get; set; }
public ICollection<XmlElement> StructuredValue { get; set; }
}

public class ConstrainedValue
{
public abstract class Constraint
{
}

public class CompareConstraint : Constraint
{
public enum CompareOperator
{
Lt,
Lte,
Gt,
Gte,
}

public CompareOperator CompareOp { get; private set; }
public ClaimValue Value { get; set; } = new ClaimValue();

public CompareConstraint(CompareOperator compareOp)
{
CompareOp = compareOp;
}
}

public class RangeConstraint : Constraint
{
public ClaimValue LowerBound { get; set; } = new ClaimValue();
public ClaimValue UpperBound { get; set; } = new ClaimValue();
}

public class ListConstraint : Constraint
{
public ICollection<ClaimValue> Values { get; private set; } =
new Collection<ClaimValue>();
}

public bool AssertConstraint { get; set; }

public ICollection<Constraint> Constraints { get; private set; } =
new Collection<Constraint>();
}
}
34 changes: 34 additions & 0 deletions Sustainsys.Saml2.Metadata/ContactPerson.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Xml;

namespace Sustainsys.Saml2.Metadata
{
public class ContactPerson
{
public string Company { get; set; }

public ICollection<string> EmailAddresses { get; private set; } =
new Collection<string>();

public string GivenName { get; set; }
public string Surname { get; set; }

public ICollection<string> TelephoneNumbers { get; private set; } =
new Collection<string>();

public ContactType Type { get; set; }

public ICollection<XmlElement> Extensions { get; private set; } =
new Collection<XmlElement>();

public ContactPerson()
{
}

public ContactPerson(ContactType type)
{
Type = type;
}
}
}
12 changes: 12 additions & 0 deletions Sustainsys.Saml2.Metadata/ContactType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Sustainsys.Saml2.Metadata
{
public enum ContactType
{
Unspecified,
Technical,
Support,
Administrative,
Billing,
Other
}
}
24 changes: 24 additions & 0 deletions Sustainsys.Saml2.Metadata/Descriptors/AffiliationDescriptor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Xml;

namespace Sustainsys.Saml2.Metadata.Descriptors
{
public class AffiliationDescriptor : ICachedMetadata
{
public ICollection<EntityId> AffiliateMembers { get; private set; } =
new Collection<EntityId>();

public ICollection<XmlElement> Extensions { get; private set; } =
new Collection<XmlElement>();

public ICollection<KeyDescriptor> KeyDescriptors { get; private set; } =
new Collection<KeyDescriptor>();

public EntityId AffiliationOwnerId { get; set; }
public DateTime? ValidUntil { get; set; }
public XsdDuration? CacheDuration { get; set; }
public string Id { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Sustainsys.Saml2.Metadata.Services;
using System.Collections.Generic;

namespace Sustainsys.Saml2.Metadata.Descriptors
{
public class ApplicationServiceDescriptor : WebServiceDescriptor
{
public ICollection<EndpointReference> Endpoints { get; private set; } =
new List<EndpointReference>();

public ICollection<EndpointReference> PassiveRequestorEndpoints { get; private set; } =
new List<EndpointReference>();

public ICollection<EndpointReference> SingleSignOutEndpoints { get; private set; } =
new List<EndpointReference>();

public ApplicationServiceDescriptor()
{
}

public ApplicationServiceDescriptor(
IEnumerable<EndpointReference> endpoints,
IEnumerable<EndpointReference> passiveRequestorEndpoints,
IEnumerable<EndpointReference> singleSignOutEndpoints
)
{
((List<EndpointReference>)Endpoints).AddRange(endpoints);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Microsoft.IdentityModel.Tokens.Saml2;
using Sustainsys.Saml2.Metadata.Services;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace Sustainsys.Saml2.Metadata.Descriptors
{
#if FALSE
public class SamlAttribute
{
public string Name { get; set; }
public Uri NameFormat { get; set; }
public string FriendlyName { get; set; }
public string Value { get; set; }
}
#endif

public class AttributeAuthorityDescriptor : RoleDescriptor
{
public ICollection<AttributeService> AttributeServices { get; private set; } =
new Collection<AttributeService>();

public ICollection<AssertionIdRequestService> AssertionIdRequestServices { get; private set; } =
new Collection<AssertionIdRequestService>();

public ICollection<NameIDFormat> NameIDFormats { get; private set; } =
new Collection<NameIDFormat>();

public ICollection<AttributeProfile> AttributeProfiles { get; private set; } =
new Collection<AttributeProfile>();

public ICollection<Saml2Attribute> Attributes { get; private set; } =
new Collection<Saml2Attribute>();
}
}
18 changes: 18 additions & 0 deletions Sustainsys.Saml2.Metadata/Descriptors/AuthnAuthorityDescriptor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Sustainsys.Saml2.Metadata.Services;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace Sustainsys.Saml2.Metadata.Descriptors
{
public class AuthnAuthorityDescriptor : RoleDescriptor
{
public ICollection<AuthnQueryService> AuthnQueryServices { get; private set; } =
new Collection<AuthnQueryService>();

public ICollection<AssertionIdRequestService> AssertionIdRequestServices { get; private set; } =
new Collection<AssertionIdRequestService>();

public ICollection<NameIDFormat> NameIDFormats { get; private set; } =
new Collection<NameIDFormat>();
}
}
24 changes: 24 additions & 0 deletions Sustainsys.Saml2.Metadata/Descriptors/EntitiesDescriptor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Xml;

namespace Sustainsys.Saml2.Metadata.Descriptors
{
public class EntitiesDescriptor : MetadataBase, ICachedMetadata
{
public ICollection<EntityDescriptor> ChildEntities { get; private set; } =
new Collection<EntityDescriptor>();

public ICollection<EntitiesDescriptor> ChildEntityGroups { get; private set; } =
new Collection<EntitiesDescriptor>();

public Collection<XmlElement> Extensions { get; private set; } =
new Collection<XmlElement>();

public string Id { get; set; }
public string Name { get; set; }
public DateTime? ValidUntil { get; set; }
public XsdDuration? CacheDuration { get; set; }
}
}
44 changes: 44 additions & 0 deletions Sustainsys.Saml2.Metadata/Descriptors/EntityDescriptor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Xml;

namespace Sustainsys.Saml2.Metadata.Descriptors
{
public class EntityDescriptor : MetadataBase, ICachedMetadata
{
public string Id { get; set; }

public ICollection<ContactPerson> Contacts { get; private set; } =
new Collection<ContactPerson>();

public EntityId EntityId { get; set; }
public string FederationId { get; set; }
public Organization Organization { get; set; }

public ICollection<RoleDescriptor> RoleDescriptors { get; private set; } =
new Collection<RoleDescriptor>();

public XsdDuration? CacheDuration { get; set; }
public DateTime? ValidUntil { get; set; }

public ICollection<AffiliationDescriptor> AffiliationDescriptors { get; private set; } =
new Collection<AffiliationDescriptor>();

public ICollection<AdditionalMetadataLocation> AdditionalMetadataLocations { get; private set; } =
new Collection<AdditionalMetadataLocation>();

public Collection<XmlElement> Extensions { get; private set; } =
new Collection<XmlElement>();

public EntityDescriptor(EntityId entityId)
{
EntityId = entityId;
}

public EntityDescriptor() :
this(null)
{
}
}
}
27 changes: 27 additions & 0 deletions Sustainsys.Saml2.Metadata/Descriptors/IdpSsoDescriptor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Microsoft.IdentityModel.Tokens.Saml2;
using Sustainsys.Saml2.Metadata.Services;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace Sustainsys.Saml2.Metadata.Descriptors
{
public class IdpSsoDescriptor : SsoDescriptor
{
public ICollection<SingleSignOnService> SingleSignOnServices { get; private set; } =
new Collection<SingleSignOnService>();

public ICollection<NameIDMappingService> NameIDMappingServices { get; private set; } =
new Collection<NameIDMappingService>();

public ICollection<AssertionIdRequestService> AssertionIDRequestServices { get; private set; } =
new Collection<AssertionIdRequestService>();

public ICollection<AttributeProfile> AttributeProfiles { get; private set; } =
new Collection<AttributeProfile>();

public ICollection<Saml2Attribute> SupportedAttributes { get; private set; } =
new Collection<Saml2Attribute>();

public bool? WantAuthnRequestsSigned { get; set; }
}
}
Loading