diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-11-15 15:30:38 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-11-15 15:30:38 -0800 |
commit | 588bc035f93607b4179df9f7f42175c08e6cf7b5 (patch) | |
tree | 965802693892616db01cf6997f060dda44518697 /projecttemplates/WebFormsRelyingParty/Code/OAuthPrincipalAuthorizationPolicy.cs | |
parent | 888abd61a54576ff244533693df77f174f03c2bb (diff) | |
parent | 2ff3e125a7db35ce459b89add580aedf7d2bd7d4 (diff) | |
download | DotNetOpenAuth-588bc035f93607b4179df9f7f42175c08e6cf7b5.zip DotNetOpenAuth-588bc035f93607b4179df9f7f42175c08e6cf7b5.tar.gz DotNetOpenAuth-588bc035f93607b4179df9f7f42175c08e6cf7b5.tar.bz2 |
Merged working branch that splits the RP project template into two projects: a web project and a class library.
Merge branch 'projecttemplateLib'
Diffstat (limited to 'projecttemplates/WebFormsRelyingParty/Code/OAuthPrincipalAuthorizationPolicy.cs')
-rw-r--r-- | projecttemplates/WebFormsRelyingParty/Code/OAuthPrincipalAuthorizationPolicy.cs | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/projecttemplates/WebFormsRelyingParty/Code/OAuthPrincipalAuthorizationPolicy.cs b/projecttemplates/WebFormsRelyingParty/Code/OAuthPrincipalAuthorizationPolicy.cs deleted file mode 100644 index b2c9a2d..0000000 --- a/projecttemplates/WebFormsRelyingParty/Code/OAuthPrincipalAuthorizationPolicy.cs +++ /dev/null @@ -1,53 +0,0 @@ -//----------------------------------------------------------------------- -// <copyright file="OAuthPrincipalAuthorizationPolicy.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. -// </copyright> -//----------------------------------------------------------------------- - -namespace WebFormsRelyingParty.Code { - using System; - using System.Collections.Generic; - using System.IdentityModel.Claims; - using System.IdentityModel.Policy; - using System.Linq; - using System.Web; - using DotNetOpenAuth.OAuth.ChannelElements; - - public class OAuthPrincipalAuthorizationPolicy : IAuthorizationPolicy { - private readonly Guid uniqueId = Guid.NewGuid(); - private readonly OAuthPrincipal principal; - - /// <summary> - /// Initializes a new instance of the <see cref="OAuthPrincipalAuthorizationPolicy"/> class. - /// </summary> - /// <param name="principal">The principal.</param> - public OAuthPrincipalAuthorizationPolicy(OAuthPrincipal principal) { - this.principal = principal; - } - - #region IAuthorizationComponent Members - - /// <summary> - /// Gets a unique ID for this instance. - /// </summary> - public string Id { - get { return this.uniqueId.ToString(); } - } - - #endregion - - #region IAuthorizationPolicy Members - - public ClaimSet Issuer { - get { return ClaimSet.System; } - } - - public bool Evaluate(EvaluationContext evaluationContext, ref object state) { - evaluationContext.AddClaimSet(this, new DefaultClaimSet(Claim.CreateNameClaim(this.principal.Identity.Name))); - evaluationContext.Properties["Principal"] = this.principal; - return true; - } - - #endregion - } -}
\ No newline at end of file |