forked from Sustainsys/Saml2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move parts of token to metadata project
- Loading branch information
Showing
57 changed files
with
365 additions
and
359 deletions.
There are no files selected for viewing
File renamed without changes.
8 changes: 2 additions & 6 deletions
8
Sustainsys.Saml2/Metadata/KeyDescriptor.cs → ...ml2.Metadata/Descriptors/KeyDescriptor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
6 changes: 1 addition & 5 deletions
6
Sustainsys.Saml2/Internal/CompareHelper.cs → ...s.Saml2.Metadata/Helpers/CompareHelper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
using Sustainsys.Saml2.Metadata.Tokens; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.Security.Cryptography; | ||
using System.Security.Cryptography.X509Certificates; | ||
using System.Xml; | ||
|
||
namespace Sustainsys.Saml2.Metadata | ||
{ | ||
public abstract class KeyData | ||
{ | ||
} | ||
|
||
public class X509Digest | ||
{ | ||
public Uri Algorithm { get; set; } | ||
public byte[] Value { get; set; } | ||
} | ||
|
||
public class X509IssuerSerial | ||
{ | ||
public string Name { get; private set; } | ||
public string Serial { get; private set; } | ||
|
||
public X509IssuerSerial(string name, string serial) | ||
{ | ||
Name = name; | ||
Serial = serial; | ||
} | ||
} | ||
|
||
public class X509Data : KeyData | ||
{ | ||
public X509IssuerSerial IssuerSerial { get; set; } | ||
public byte[] SKI { get; set; } | ||
public string SubjectName { get; set; } | ||
|
||
public ICollection<X509Certificate2> Certificates { get; set; } = | ||
new Collection<X509Certificate2>(); | ||
|
||
public byte[] CRL { get; set; } | ||
public X509Digest Digest { get; set; } | ||
} | ||
|
||
public class RetrievalMethod | ||
{ | ||
public Uri Uri { get; set; } | ||
public Uri Type { get; set; } | ||
|
||
public ICollection<XmlElement> Transforms { get; private set; } = | ||
new Collection<XmlElement>(); | ||
} | ||
|
||
public abstract class KeyValue | ||
{ | ||
} | ||
|
||
public class DsaKeyValue : KeyValue | ||
{ | ||
public DSAParameters Parameters { get; set; } | ||
|
||
public DsaKeyValue(DSAParameters parameters) | ||
{ | ||
Parameters = parameters; | ||
} | ||
} | ||
|
||
public class RsaKeyValue : KeyValue | ||
{ | ||
public RSAParameters Parameters { get; set; } | ||
|
||
public RsaKeyValue(RSAParameters parameters) | ||
{ | ||
Parameters = parameters; | ||
} | ||
} | ||
|
||
#if !NET461 | ||
|
||
public class EcKeyValue : KeyValue | ||
{ | ||
public ECParameters Parameters { get; set; } | ||
|
||
public EcKeyValue(ECParameters parameters) | ||
{ | ||
Parameters = parameters; | ||
} | ||
} | ||
|
||
#endif | ||
|
||
public class DSigKeyInfo | ||
{ | ||
public string Id { get; set; } | ||
|
||
public ICollection<string> KeyNames { get; private set; } = | ||
new Collection<string>(); | ||
|
||
public ICollection<KeyValue> KeyValues { get; private set; } = | ||
new Collection<KeyValue>(); | ||
|
||
public ICollection<RetrievalMethod> RetrievalMethods { get; private set; } = | ||
new Collection<RetrievalMethod>(); | ||
|
||
public ICollection<KeyData> Data { get; private set; } = | ||
new Collection<KeyData>(); | ||
|
||
public SecurityKeyIdentifier MakeSecurityKeyIdentifier() | ||
{ | ||
var ski = new SecurityKeyIdentifier(); | ||
foreach (var keyValue in KeyValues) | ||
{ | ||
if (keyValue is RsaKeyValue rsaKeyValue) | ||
{ | ||
ski.Add(new RsaKeyIdentifierClause(rsaKeyValue.Parameters)); | ||
} | ||
else if (keyValue is DsaKeyValue dsaKeyValue) | ||
{ | ||
ski.Add(new DsaKeyIdentifierClause(dsaKeyValue.Parameters)); | ||
} | ||
#if !NET461 | ||
else if (keyValue is EcKeyValue ecKeyValue) | ||
{ | ||
ski.Add(new EcKeyIdentifierClause(ecKeyValue.Parameters)); | ||
} | ||
#endif | ||
} | ||
foreach (string keyName in KeyNames) | ||
{ | ||
ski.Add(new KeyNameIdentifierClause(keyName)); | ||
} | ||
foreach (var keyData in Data) | ||
{ | ||
if (keyData is X509Data x509Data) | ||
{ | ||
foreach (var cert in x509Data.Certificates) | ||
{ | ||
ski.Add(new X509RawDataKeyIdentifierClause(cert)); | ||
} | ||
if (x509Data.IssuerSerial != null) | ||
{ | ||
ski.Add(new X509IssuerSerialKeyIdentifierClause( | ||
x509Data.IssuerSerial.Name, x509Data.IssuerSerial.Serial)); | ||
} | ||
} | ||
} | ||
return ski; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Sustainsys.Saml2.Metadata | ||
{ | ||
public enum KeyType | ||
{ | ||
Unspecified = 0, | ||
Signing = 1, | ||
Encryption = 2 | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...2.Metadata/Services/ApplicationService.cs → ...ta/Services/ApplicationServiceEndpoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
namespace Sustainsys.Saml2.Metadata.Services | ||
{ | ||
public class ApplicationService : Endpoint | ||
public class ApplicationServiceEndpoint : Endpoint | ||
{ | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
Sustainsys.Saml2.Metadata/Services/PassiveRequestorEndpoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace Sustainsys.Saml2.Metadata.Services | ||
{ | ||
public class PassiveRequestorEndpoint : Endpoint | ||
{ | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
Sustainsys.Saml2.Metadata/Services/SingleSignOutNotificationEndpoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace Sustainsys.Saml2.Metadata.Services | ||
{ | ||
public class SingleSignOutNotificationEndpoint : Endpoint | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...sys.Saml2/Tokens/AsymmetricSecurityKey.cs → ....Metadata/Tokens/AsymmetricSecurityKey.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...Saml2/Tokens/BinaryKeyIdentifierClause.cs → ...adata/Tokens/BinaryKeyIdentifierClause.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 3 additions & 4 deletions
7
...ys.Saml2/Tokens/DsaKeyIdentifierClause.cs → ...Metadata/Tokens/DsaKeyIdentifierClause.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...sys.Saml2/Tokens/EcKeyIdentifierClause.cs → ....Metadata/Tokens/EcKeyIdentifierClause.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s.Saml2/Tokens/KeyNameIdentifierClause.cs → ...etadata/Tokens/KeyNameIdentifierClause.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 3 additions & 5 deletions
8
...ys.Saml2/Tokens/RsaKeyIdentifierClause.cs → ...Metadata/Tokens/RsaKeyIdentifierClause.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ainsys.Saml2/Tokens/SecurityAlgorithms.cs → ...ml2.Metadata/Tokens/SecurityAlgorithms.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Sustainsys.Saml2/Tokens/SecurityKey.cs → ...nsys.Saml2.Metadata/Tokens/SecurityKey.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.