Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,102 @@
//
// AuthorizationContext.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2005 Novell, Inc. http://www.novell.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.
//
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IdentityModel.Claims;
using System.Xml;
namespace System.IdentityModel.Policy
{
public abstract class AuthorizationContext :
IAuthorizationComponent
{
[MonoTODO]
public static AuthorizationContext
CreateDefaultAuthorizationContext (IList<IAuthorizationPolicy> policies)
{
if (policies == null)
throw new ArgumentNullException ("policies");
string id = new UniqueId ().ToString ();
DefaultEvaluationContext ctx =
new DefaultEvaluationContext ();
foreach (IAuthorizationPolicy a in policies) {
object o = null;
a.Evaluate (ctx, ref o);
}
return new DefaultAuthorizationContext (id, ctx);
}
protected AuthorizationContext ()
{
}
public abstract DateTime ExpirationTime { get; }
public abstract string Id { get; }
public abstract ReadOnlyCollection<ClaimSet> ClaimSets { get; }
public abstract IDictionary<string,object> Properties { get; }
// default implementation: this class will be used for
// CreateDefaultAuthorizationContext().
class DefaultAuthorizationContext : AuthorizationContext
{
DefaultEvaluationContext ctx;
string id;
public DefaultAuthorizationContext (
string id, DefaultEvaluationContext context)
{
this.id = id;
this.ctx = context;
}
public override DateTime ExpirationTime {
get { return ctx.ExpirationTime; }
}
public override string Id {
get { return id; }
}
public override ReadOnlyCollection<ClaimSet> ClaimSets {
get { return ctx.ClaimSets; }
}
public override IDictionary<string,object> Properties {
get { return ctx.Properties; }
}
}
}
}

View File

@@ -0,0 +1,66 @@
2006-12-08 Atsushi Enomoto <atsushi@ximian.com>
* AuthorizationContext.cs : (CreateDefaultAuthorizationContext)
check null argument.
2006-10-11 Atsushi Enomoto <atsushi@ximian.com>
* AuthorizationContext.cs : changed DefaultAuthorizationContext to
receive DefaultEvaluationContext to implement its properties.
Implemented CreateDefaultAuthorizationContext().
* EvaluationContext.cs : (DefaultEvaluationContext) implemented
AddClaimSet() and RecordExpirationTime().
2006-07-04 Atsushi Enomoto <atsushi@ximian.com>
* EvaluationContext.cs, AuthorizationContext.cs : June CTP updates.
Also moved internal default impl. classes into those files.
* AcceptClaimSetEventArgs.cs, AuthorizationContextBase.cs,
EvaluationContextBase.cs : removed old code.
2006-03-22 Atsushi Enomoto <atsushi@ximian.com>
* EvaluationContext.cs AuthorizationContextBase.cs
AuthorizationContext.cs EvaluationContextBase.cs :
several fixes to match Feb. CTP API.
2006-02-23 Atsushi Enomoto <atsushi@ximian.com>
* AcceptClaimSetEventArgs.cs AcceptPolicyEventArgs.cs
AuthorizationContext.cs AuthorizationContextBase.cs
AuthorizationDomain.cs ClaimComparer.cs EvaluationContext.cs
EvaluationContextBase.cs IAuthorizationComponent.cs
IAuthorizationPolicy.cs ResourceRights.cs ResourceTypes.cs :
Moving namespaces to System.IdentityModel.*.
2006-01-19 Atsushi Enomoto <atsushi@ximian.com>
* ResourceTypes.cs EvaluationContext.cs ClaimComparer.cs Claim.cs
AuthorizationDomain.cs ClaimSetBase.cs IAuthorizationComponent.cs
AuthorizationContextBase.cs ClaimSet.cs AuthorizationContext.cs
EvaluationContextBase.cs ResourceRights.cs :
several updates to catch up Jan. CTP API.
2005-09-27 Atsushi Enomoto <atsushi@ximian.com>
* ClaimSetBase.cs, AuthorizationContextBase.cs : more missing bits.
2005-09-27 Atsushi Enomoto <atsushi@ximian.com>
* Dummy.cs: it is not required anymore.
* IAuthorizationPolicy.cs, IAuthorizationComponent.cs,
AcceptPolicyEventArgs.cs, AcceptClaimSetEventArgs.cs,
AuthorizationContextBase.cs, AuthorizationContext.cs :
new files.
* EvaluationContext.cs: copyright lines.
AuthorizationDomain.cs : added events.
ClaimSetBase.cs: implemented.
2005-09-27 Atsushi Enomoto <atsushi@ximian.com>
* ClaimSetBase.cs, EvaluationContext.cs, ClaimSet.cs
EvaluationContextBase.cs, AuthorizationDomain.cs : new files.
* ClaimComparer.cs, Claim.cs, ResourceRights.cs, ResourceTypes.cs :
added copyright lines.
* Dummy.cs : removed lines for added types.

View File

@@ -0,0 +1,106 @@
//
// EvaluationContext.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2005 Novell, Inc. http://www.novell.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.
//
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IdentityModel.Claims;
namespace System.IdentityModel.Policy
{
public abstract class EvaluationContext
{
protected EvaluationContext ()
{
}
public abstract int Generation { get; }
public abstract IDictionary<string,object> Properties { get; }
public abstract ReadOnlyCollection<ClaimSet> ClaimSets { get; }
public abstract void AddClaimSet (
IAuthorizationPolicy authorizationPolicy,
ClaimSet claimSet);
public abstract void RecordExpirationTime (DateTime time);
}
// default implementation
internal class DefaultEvaluationContext : EvaluationContext
{
DateTime expiration_time = DateTime.MaxValue.AddDays (-1);
int generation;
Collection<ClaimSet> claim_sets;
ReadOnlyCollection<ClaimSet> exposed_claim_sets;
Dictionary<string,object> properties =
new Dictionary<string,object> ();
Dictionary<IAuthorizationPolicy,ClaimSet> claim_set_map =
new Dictionary<IAuthorizationPolicy,ClaimSet> ();
public DefaultEvaluationContext ()
{
claim_sets = new Collection<ClaimSet> ();
exposed_claim_sets =
new ReadOnlyCollection<ClaimSet> (claim_sets);
}
public override int Generation {
get { return generation; }
}
public override IDictionary<string,object> Properties {
get { return properties; }
}
public override ReadOnlyCollection<ClaimSet> ClaimSets {
get { return exposed_claim_sets; }
}
public override void AddClaimSet (
IAuthorizationPolicy authorizationPolicy,
ClaimSet claimSet)
{
generation++;
claim_set_map.Add (authorizationPolicy, claimSet);
claim_sets.Add (claimSet);
}
public override void RecordExpirationTime (DateTime time)
{
expiration_time = time;
}
internal DateTime ExpirationTime {
get { return expiration_time; }
}
}
}

View File

@@ -0,0 +1,35 @@
//
// IAuthorizationComponent.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2005 Novell, Inc. http://www.novell.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.
//
namespace System.IdentityModel.Policy
{
public interface IAuthorizationComponent
{
string Id { get; }
}
}

View File

@@ -0,0 +1,39 @@
//
// IAuthorizationPolicy.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2005 Novell, Inc. http://www.novell.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.
//
using System.IdentityModel.Claims;
namespace System.IdentityModel.Policy
{
public interface IAuthorizationPolicy : IAuthorizationComponent
{
ClaimSet Issuer { get; }
bool Evaluate (EvaluationContext evaluationContext,
ref object state);
}
}