Skip to content

Commit

Permalink
move some codes related to metadata to its project
Browse files Browse the repository at this point in the history
  • Loading branch information
rpmansion committed Apr 10, 2020
1 parent 1de9171 commit 67a3c0d
Show file tree
Hide file tree
Showing 86 changed files with 961 additions and 886 deletions.
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
}
}
17 changes: 17 additions & 0 deletions Sustainsys.Saml2.Metadata/EntityId.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace Sustainsys.Saml2.Metadata
{
public class EntityId
{
public string Id { get; set; }

public EntityId(string id)
{
Id = id;
}

public EntityId() :
this(null)
{
}
}
}
18 changes: 18 additions & 0 deletions Sustainsys.Saml2.Metadata/ICachedMetadata.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;

namespace Sustainsys.Saml2.Metadata
{
// TODO : remove public once all related metadata codes moved to the project
public interface ICachedMetadata
{
/// <summary>
/// Permitted cache duration for the metadata.
/// </summary>
XsdDuration? CacheDuration { get; set; }

/// <summary>
/// Valid until
/// </summary>
DateTime? ValidUntil { get; set; }
}
}
16 changes: 16 additions & 0 deletions Sustainsys.Saml2.Metadata/Localization/LocalizedEntry.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace Sustainsys.Saml2.Metadata.Localization
{
public abstract class LocalizedEntry
{
public string Language { get; set; }

protected LocalizedEntry()
{
}

protected LocalizedEntry(string language)
{
Language = language;
}
}
}
12 changes: 12 additions & 0 deletions Sustainsys.Saml2.Metadata/Localization/LocalizedEntryCollection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Collections.ObjectModel;

namespace Sustainsys.Saml2.Metadata.Localization
{
public class LocalizedEntryCollection<T> : KeyedCollection<string, T> where T : LocalizedEntry
{
protected override string GetKeyForItem(T item)
{
return item.Language;
}
}
}
17 changes: 17 additions & 0 deletions Sustainsys.Saml2.Metadata/Localization/LocalizedName.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace Sustainsys.Saml2.Metadata.Localization
{
public class LocalizedName : LocalizedEntry
{
public string Name { get; set; }

public LocalizedName(string name, string language) :
base(language)
{
Name = name;
}

public LocalizedName()
{
}
}
}
20 changes: 20 additions & 0 deletions Sustainsys.Saml2.Metadata/Localization/LocalizedUri.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;

namespace Sustainsys.Saml2.Metadata.Localization
{
public class LocalizedUri : LocalizedEntry
{
public Uri Uri { get; set; }

public LocalizedUri(Uri uri, string language) :
base(language)
{
Uri = uri;
}

public LocalizedUri() :
this(null, null)
{
}
}
}
9 changes: 9 additions & 0 deletions Sustainsys.Saml2.Metadata/NameIDFormat.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;

namespace Sustainsys.Saml2.Metadata
{
public class NameIDFormat
{
public Uri Uri { get; set; }
}
}
22 changes: 22 additions & 0 deletions Sustainsys.Saml2.Metadata/Organization.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Sustainsys.Saml2.Metadata.Localization;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Xml;

namespace Sustainsys.Saml2.Metadata
{
public class Organization
{
public ICollection<XmlElement> Extensions { get; private set; } =
new Collection<XmlElement>();

public LocalizedEntryCollection<LocalizedName> DisplayNames { get; private set; } =
new LocalizedEntryCollection<LocalizedName>();

public LocalizedEntryCollection<LocalizedName> Names { get; private set; } =
new LocalizedEntryCollection<LocalizedName>();

public LocalizedEntryCollection<LocalizedUri> Urls { get; private set; } =
new LocalizedEntryCollection<LocalizedUri>();
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using Microsoft.IdentityModel.Tokens.Saml2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sustainsys.Saml2.Metadata
{
Expand All @@ -20,35 +17,35 @@ public RequestedAttribute(string name)
: base(name)
{ }

/// <summary>
/// Ctor
/// </summary>
/// <param name="name">Name of the attribute.</param>
/// <param name="value">Value of the attribute.</param>
public RequestedAttribute(string name, string value)
: base(name, value)
{ }
/// <summary>
/// Ctor
/// </summary>
/// <param name="name">Name of the attribute.</param>
/// <param name="value">Value of the attribute.</param>
public RequestedAttribute(string name, string value)
: base(name, value)
{ }

/// <summary>
/// Is this attribute required by the service provider?
/// </summary>
public bool? IsRequired { get; set; }
/// <summary>
/// Is this attribute required by the service provider?
/// </summary>
public bool? IsRequired { get; set; }

/// <summary>
/// Uri used for NameFormat to specify that the Name is a Uri.
/// </summary>
public static readonly Uri AttributeNameFormatUri = new Uri("urn:oasis:names:tc:SAML:2.0:attrname-format:uri");

/// <summary>
/// Uri used for NameFormat to specify that the format of the Name
/// Uri used for NameFormat to specify that the format of the Name
/// is unspecified.
/// </summary>
public static readonly Uri AttributeNameFormatUnspecified = new Uri("urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified");

/// <summary>
/// Uri used for NameFormat to specify that the format of the Name
/// Uri used for NameFormat to specify that the format of the Name
/// fulfills the standard's basic requirements.
/// </summary>
public static readonly Uri AttributeNameFormatBasic = new Uri("urn:oasis:names:tc:SAML:2.0:attrname-format:basic");
}
}
}
8 changes: 8 additions & 0 deletions Sustainsys.Saml2.Metadata/ServiceName.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Sustainsys.Saml2.Metadata
{
public class ServiceName
{
public string PortName { get; set; }
public string Name { get; set; }
}
}
6 changes: 6 additions & 0 deletions Sustainsys.Saml2.Metadata/Services/ApplicationService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Sustainsys.Saml2.Metadata.Services
{
public class ApplicationService : Endpoint
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Sustainsys.Saml2.Metadata.Services
{
public class ArtifactResolutionService : IndexedEndpoint
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Sustainsys.Saml2.Metadata.Services
{
public class AssertionConsumerService : IndexedEndpoint
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Sustainsys.Saml2.Metadata.Services
{
public class AssertionIdRequestService : Endpoint
{
}
}
45 changes: 45 additions & 0 deletions Sustainsys.Saml2.Metadata/Services/AttributeConsumingService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using Sustainsys.Saml2.Metadata.Localization;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace Sustainsys.Saml2.Metadata.Services
{
/// <summary>
/// Metadata for an attribute consuming service.
/// </summary>
public class AttributeConsumingService : IIndexedEntryWithDefault
{
/// <summary>
/// Index of the endpoint
/// </summary>
public int Index { get; set; }

/// <summary>
/// Is this the default endpoint?
/// </summary>
public bool? IsDefault { get; set; }

/// <summary>
/// Is the service required?
/// </summary>
public bool? IsRequired { get; set; }

/// <summary>
/// The name of the attribute consuming service.
/// </summary>
public ICollection<LocalizedName> ServiceNames { get; private set; }
= new Collection<LocalizedName>();

/// <summary>
/// Description of the attribute consuming service
/// </summary>
public ICollection<LocalizedName> ServiceDescriptions { get; private set; }
= new Collection<LocalizedName>();

/// <summary>
/// Requested attributes.
/// </summary>
public ICollection<RequestedAttribute> RequestedAttributes { get; private set; }
= new Collection<RequestedAttribute>();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Sustainsys.Saml2.Metadata
namespace Sustainsys.Saml2.Metadata.Services
{
public class AttributeService : Endpoint
{
}
}
}
6 changes: 6 additions & 0 deletions Sustainsys.Saml2.Metadata/Services/AuthnQueryService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Sustainsys.Saml2.Metadata.Services
{
public class AuthnQueryService : Endpoint
{
}
}
6 changes: 6 additions & 0 deletions Sustainsys.Saml2.Metadata/Services/AuthzService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Sustainsys.Saml2.Metadata.Services
{
public class AuthzService : Endpoint
{
}
}
21 changes: 21 additions & 0 deletions Sustainsys.Saml2.Metadata/Services/Endpoint.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;

namespace Sustainsys.Saml2.Metadata.Services
{
public class Endpoint
{
public Uri Binding { get; set; }
public Uri Location { get; set; }
public Uri ResponseLocation { get; set; }

public Endpoint()
{
}

public Endpoint(Uri binding, Uri location)
{
Binding = binding;
Location = location;
}
}
}
Loading

0 comments on commit 67a3c0d

Please sign in to comment.