summaryrefslogtreecommitdiffstats
path: root/samples/DotNetOpenAuth.ApplicationBlock/OAuthPrincipal.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-06-25 19:51:02 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2009-06-25 19:51:02 -0700
commit3b2fe4819cf449d1ab88178d055239c64b3cfd5e (patch)
treee191391cc71af22a854a06fee0079dbb74405752 /samples/DotNetOpenAuth.ApplicationBlock/OAuthPrincipal.cs
parent97e3fc44a6911289baf3435febc0b003e56ad4e8 (diff)
parentf3ce247dfaa965011c7f8417d00e0fa3dfad4a35 (diff)
downloadDotNetOpenAuth-3b2fe4819cf449d1ab88178d055239c64b3cfd5e.zip
DotNetOpenAuth-3b2fe4819cf449d1ab88178d055239c64b3cfd5e.tar.gz
DotNetOpenAuth-3b2fe4819cf449d1ab88178d055239c64b3cfd5e.tar.bz2
Merge branch 'master' into contracts
Conflicts: src/DotNetOpenAuth.vsmdi src/DotNetOpenAuth/Configuration/TypeConfigurationCollection.cs src/DotNetOpenAuth/Configuration/TypeConfigurationElement.cs src/DotNetOpenAuth/DotNetOpenAuth.csproj src/DotNetOpenAuth/Messaging/HttpRequestInfo.cs src/DotNetOpenAuth/Messaging/Reflection/MessagePart.cs src/DotNetOpenAuth/Messaging/Reflection/ValueMapping.cs src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs src/DotNetOpenAuth/OAuth/ConsumerBase.cs src/DotNetOpenAuth/OAuth/Messages/MessageBase.cs src/DotNetOpenAuth/OAuth/Messages/UnauthorizedTokenResponse.cs src/DotNetOpenAuth/OAuth/ServiceProvider.cs src/DotNetOpenAuth/OpenId/Protocol.cs src/DotNetOpenAuth/OpenId/Provider/AutoResponsiveRequest.cs src/DotNetOpenAuth/OpenId/Provider/HostProcessedRequest.cs src/DotNetOpenAuth/OpenId/Provider/IHostProcessedRequest.cs src/DotNetOpenAuth/OpenId/Provider/Request.cs src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingParty.cs src/DotNetOpenAuth/OpenId/RelyingParty/ServiceEndpoint.cs
Diffstat (limited to 'samples/DotNetOpenAuth.ApplicationBlock/OAuthPrincipal.cs')
-rw-r--r--samples/DotNetOpenAuth.ApplicationBlock/OAuthPrincipal.cs67
1 files changed, 0 insertions, 67 deletions
diff --git a/samples/DotNetOpenAuth.ApplicationBlock/OAuthPrincipal.cs b/samples/DotNetOpenAuth.ApplicationBlock/OAuthPrincipal.cs
deleted file mode 100644
index 88f3b83..0000000
--- a/samples/DotNetOpenAuth.ApplicationBlock/OAuthPrincipal.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="OAuthPrincipal.cs" company="Andrew Arnott">
-// Copyright (c) Andrew Arnott. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.ApplicationBlock {
- using System;
- using System.Linq;
- using System.Runtime.InteropServices;
- using System.Security.Principal;
-
- /// <summary>
- /// Represents an OAuth consumer that is impersonating a known user on the system.
- /// </summary>
- [Serializable]
- [ComVisible(true)]
- internal class OAuthPrincipal : IPrincipal {
- /// <summary>
- /// The roles this user belongs to.
- /// </summary>
- private string[] roles;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="OAuthPrincipal"/> class.
- /// </summary>
- /// <param name="identity">The identity.</param>
- /// <param name="roles">The roles this user belongs to.</param>
- internal OAuthPrincipal(OAuthIdentity identity, string[] roles) {
- this.Identity = identity;
- this.roles = roles;
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="OAuthPrincipal"/> class.
- /// </summary>
- /// <param name="username">The username.</param>
- /// <param name="roles">The roles this user belongs to.</param>
- internal OAuthPrincipal(string username, string[] roles)
- : this(new OAuthIdentity(username), roles) {
- }
-
- #region IPrincipal Members
-
- /// <summary>
- /// Gets the identity of the current principal.
- /// </summary>
- /// <value></value>
- /// <returns>
- /// The <see cref="T:System.Security.Principal.IIdentity"/> object associated with the current principal.
- /// </returns>
- public IIdentity Identity { get; private set; }
-
- /// <summary>
- /// Determines whether the current principal belongs to the specified role.
- /// </summary>
- /// <param name="role">The name of the role for which to check membership.</param>
- /// <returns>
- /// true if the current principal is a member of the specified role; otherwise, false.
- /// </returns>
- public bool IsInRole(string role) {
- return this.roles.Contains(role);
- }
-
- #endregion
- }
-}