Imported Upstream version 3.10.0

Former-commit-id: 172c8e3c300b39d5785c7a3e8dfb08ebdbc1a99b
This commit is contained in:
Jo Shields
2014-10-04 11:27:48 +01:00
parent fe777c5c82
commit 8b9b85e7f5
970 changed files with 20242 additions and 31308 deletions

View File

@ -0,0 +1,53 @@
//
// BinaryExchange.cs
//
// Author:
// Noesis Labs (Ryan.Melena@noesislabs.com)
//
// Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
using System;
namespace System.IdentityModel.Protocols.WSTrust
{
public class BinaryExchange
{
private const string defaultEncodingTypeUrl = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary";
public byte[] BinaryData { get; private set; }
public Uri EncodingType { get; private set; }
public Uri ValueType { get; private set; }
public BinaryExchange (byte[] binaryData, Uri valueType)
: this (binaryData, valueType, new Uri (defaultEncodingTypeUrl))
{ }
public BinaryExchange (byte[] binaryData, Uri valueType, Uri encodingType) {
BinaryData = binaryData;
ValueType = valueType;
EncodingType = encodingType;
}
}
}
#endif

View File

@ -0,0 +1,64 @@
//
// EndpointReference.cs
//
// Author:
// Noesis Labs (Ryan.Melena@noesislabs.com)
//
// Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
using System;
using System.Collections.ObjectModel;
using System.Xml;
namespace System.IdentityModel.Protocols.WSTrust
{
public class EndpointReference
{
private Collection<XmlElement> details = new Collection<XmlElement> ();
private Uri uri = null;
public Collection<XmlElement> Details { get { return details; } }
public Uri Uri { get { return uri; } }
public EndpointReference (string uri) {
this.uri = new Uri (uri);
}
[MonoTODO]
public static EndpointReference ReadFrom (XmlDictionaryReader reader) {
throw new NotImplementedException ();
}
[MonoTODO]
public static EndpointReference ReadFrom(Xml.XmlReader reader) {
throw new NotImplementedException ();
}
[MonoTODO]
public void WriteTo (XmlWriter writer) {
throw new NotImplementedException ();
}
}
}
#endif

View File

@ -0,0 +1,60 @@
//
// Entropy.cs
//
// Author:
// Noesis Labs (Ryan.Melena@noesislabs.com)
//
// Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
using System.IdentityModel.Tokens;
using System.Security.Cryptography;
namespace System.IdentityModel.Protocols.WSTrust
{
public class Entropy : ProtectedKey
{
public Entropy (ProtectedKey protectedKey) : base (protectedKey.GetKeyBytes (), protectedKey.WrappingCredentials)
{ }
public Entropy (byte[] secret) : base (secret)
{ }
public Entropy (int entropySizeInBits)
: this(Entropy.GetRandomByteArray(entropySizeInBits / 8))
{ }
public Entropy (byte[] secret, EncryptingCredentials wrappingCredentials) : base (secret, wrappingCredentials)
{ }
private static byte[] GetRandomByteArray (int arraySize) {
byte[] b = new byte[arraySize];
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
rng.GetNonZeroBytes(b);
return b;
}
}
}
#endif

View File

@ -0,0 +1,49 @@
//
// Lifetime.cs
//
// Author:
// Noesis Labs (Ryan.Melena@noesislabs.com)
//
// Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
using System;
namespace System.IdentityModel.Protocols.WSTrust
{
public class Lifetime
{
public DateTime? Created { get; set; }
public DateTime? Expires { get; set; }
public Lifetime (DateTime created, DateTime expires)
: this ((DateTime?)created, (DateTime?)expires)
{ }
public Lifetime (DateTime? created, DateTime? expires) {
if (created.HasValue) { Created = created.Value.ToUniversalTime (); }
if (expires.HasValue) { Expires = expires.Value.ToUniversalTime (); }
}
}
}
#endif

View File

@ -0,0 +1,55 @@
//
// ProtectedKey.cs
//
// Author:
// Noesis Labs (Ryan.Melena@noesislabs.com)
//
// Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
using System;
using System.IdentityModel.Tokens;
namespace System.IdentityModel.Protocols.WSTrust
{
public class ProtectedKey
{
private byte[] secret;
public EncryptingCredentials WrappingCredentials { get; private set; }
public ProtectedKey (byte[] secret) {
this.secret = secret;
}
public ProtectedKey (byte[] secret, EncryptingCredentials wrappingCredentials) {
this.secret = secret;
WrappingCredentials = wrappingCredentials;
}
public byte[] GetKeyBytes () {
return secret;
}
}
}
#endif

View File

@ -0,0 +1,55 @@
//
// RequestSecurityTokenResponse.cs
//
// Author:
// Noesis Labs (Ryan.Melena@noesislabs.com)
//
// Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
using System.IdentityModel.Tokens;
namespace System.IdentityModel.Protocols.WSTrust
{
public class RequestSecurityTokenResponse : WSTrustMessage
{
public bool IsFinal { get; set; }
public SecurityKeyIdentifierClause RequestedAttachedReference { get; set; }
public RequestedProofToken RequestedProofToken { get; set; }
public RequestedSecurityToken RequestedSecurityToken { get; set; }
public bool RequestedTokenCancelled { get; set; }
public SecurityKeyIdentifierClause RequestedUnattachedReference { get; set; }
public Status Status { get; set; }
public RequestSecurityTokenResponse ()
{ }
public RequestSecurityTokenResponse (WSTrustMessage message) {
Context = message.Context;
KeyType = message.KeyType;
KeySizeInBits = message.KeySizeInBits;
RequestType = message.RequestType;
}
}
}
#endif

View File

@ -0,0 +1,57 @@
//
// RequestedProofToken.cs
//
// Author:
// Noesis Labs (Ryan.Melena@noesislabs.com)
//
// Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
using System;
using System.IdentityModel.Tokens;
namespace System.IdentityModel.Protocols.WSTrust
{
public class RequestedProofToken
{
public string ComputedKeyAlgorithm { get; private set; }
public ProtectedKey ProtectedKey { get; private set; }
public RequestedProofToken (ProtectedKey protectedKey) {
ProtectedKey = protectedKey;
}
public RequestedProofToken (Byte[] secret) {
ProtectedKey = new ProtectedKey (secret);
}
public RequestedProofToken (string computedKeyAlgorithm) {
ComputedKeyAlgorithm = computedKeyAlgorithm;
}
public RequestedProofToken (Byte[] secret, EncryptingCredentials wrappingCredentials) {
ProtectedKey = new ProtectedKey (secret, wrappingCredentials);
}
}
}
#endif

View File

@ -0,0 +1,50 @@
//
// RequestedSecurityToken.cs
//
// Author:
// Noesis Labs (Ryan.Melena@noesislabs.com)
//
// Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
using System;
using System.IdentityModel.Tokens;
using System.Xml;
namespace System.IdentityModel.Protocols.WSTrust
{
public class RequestedSecurityToken
{
public SecurityToken SecurityToken { get; private set; }
public virtual XmlElement SecurityTokenXml { get; private set; }
public RequestedSecurityToken (SecurityToken token) {
SecurityToken = token;
}
public RequestedSecurityToken (XmlElement tokenAsXml) {
SecurityTokenXml = tokenAsXml;
}
}
}
#endif

View File

@ -0,0 +1,45 @@
//
// Status.cs
//
// Author:
// Noesis Labs (Ryan.Melena@noesislabs.com)
//
// Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
using System;
namespace System.IdentityModel.Protocols.WSTrust
{
public class Status
{
public string Code { get; set; }
public string Reason { get; set; }
public Status (string code, string reason) {
Code = code;
Reason = reason;
}
}
}
#endif

View File

@ -0,0 +1,57 @@
//
// UseKey.cs
//
// Author:
// Noesis Labs (Ryan.Melena@noesislabs.com)
//
// Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
using System;
using System.IdentityModel.Tokens;
namespace System.IdentityModel.Protocols.WSTrust
{
public class UseKey
{
public SecurityKeyIdentifier SecurityKeyIdentifier { get; private set; }
public SecurityToken Token { get; private set; }
public UseKey () : this (null, null)
{ }
public UseKey (SecurityKeyIdentifier ski)
: this (ski, null)
{ }
public UseKey (SecurityToken token)
: this (null, token)
{ }
public UseKey (SecurityKeyIdentifier ski, SecurityToken token) {
SecurityKeyIdentifier = ski;
Token = token;
}
}
}
#endif

View File

@ -0,0 +1,58 @@
//
// WSTrustMessage.cs
//
// Author:
// Noesis Labs (Ryan.Melena@noesislabs.com)
//
// Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
using System;
using System.IdentityModel;
namespace System.IdentityModel.Protocols.WSTrust
{
public abstract class WSTrustMessage : OpenObject
{
public bool AllowPostdating { get; set; }
public EndpointReference AppliesTo { get; set; }
public string AuthenticationType { get; set; }
public BinaryExchange BinaryExchange { get; set; }
public string CanonicalizationAlgorithm { get; set; }
public string Context { get; set; }
public string EncryptionAlgorithm { get; set; }
public string EncryptWith { get; set; }
public Entropy Entropy { get; set; }
public int? KeySizeInBits { get; set; }
public string KeyType { get; set; }
public string KeyWrapAlgorithm { get; set; }
public Lifetime Lifetime { get; set; }
public string ReplyTo { get; set; }
public string RequestType { get; set; }
public string SignatureAlgorithm { get; set; }
public string SignWith { get; set; }
public string TokenType { get; set; }
public UseKey UseKey { get; set; }
}
}
#endif