summaryrefslogtreecommitdiffstats
path: root/samples/DotNetOpenAuth.ApplicationBlock
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-06-23 18:03:40 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2009-06-23 18:03:40 -0700
commit39dea3bfb16fd38b1f6aafb1324abcd006a358be (patch)
tree0a51f04ad8505f97d3c6d1ed1c9221b8be2b231f /samples/DotNetOpenAuth.ApplicationBlock
parent73bdb918f37382a8985f597416746b4c55283dca (diff)
downloadDotNetOpenAuth-39dea3bfb16fd38b1f6aafb1324abcd006a358be.zip
DotNetOpenAuth-39dea3bfb16fd38b1f6aafb1324abcd006a358be.tar.gz
DotNetOpenAuth-39dea3bfb16fd38b1f6aafb1324abcd006a358be.tar.bz2
Promoted the OAuthIdentity and OAuthPrincipal classes from ApplicationBlock to the core library.
Diffstat (limited to 'samples/DotNetOpenAuth.ApplicationBlock')
-rw-r--r--samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj2
-rw-r--r--samples/DotNetOpenAuth.ApplicationBlock/OAuthIdentity.cs63
-rw-r--r--samples/DotNetOpenAuth.ApplicationBlock/OAuthPrincipal.cs67
3 files changed, 0 insertions, 132 deletions
diff --git a/samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj b/samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj
index 9aae9ca..976a325 100644
--- a/samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj
+++ b/samples/DotNetOpenAuth.ApplicationBlock/DotNetOpenAuth.ApplicationBlock.csproj
@@ -59,8 +59,6 @@
<Compile Include="CustomExtensions\AcmeRequest.cs" />
<Compile Include="CustomExtensions\AcmeResponse.cs" />
<Compile Include="GoogleConsumer.cs" />
- <Compile Include="OAuthIdentity.cs" />
- <Compile Include="OAuthPrincipal.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TwitterConsumer.cs" />
<Compile Include="Util.cs" />
diff --git a/samples/DotNetOpenAuth.ApplicationBlock/OAuthIdentity.cs b/samples/DotNetOpenAuth.ApplicationBlock/OAuthIdentity.cs
deleted file mode 100644
index ea9ec0b..0000000
--- a/samples/DotNetOpenAuth.ApplicationBlock/OAuthIdentity.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="OAuthIdentity.cs" company="Andrew Arnott">
-// Copyright (c) Andrew Arnott. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.ApplicationBlock {
- using System;
- 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 OAuthIdentity : IIdentity {
- /// <summary>
- /// Initializes a new instance of the <see cref="OAuthIdentity"/> class.
- /// </summary>
- /// <param name="username">The username.</param>
- internal OAuthIdentity(string username) {
- if (String.IsNullOrEmpty(username)) {
- throw new ArgumentNullException("username");
- }
-
- this.Name = username;
- }
-
- #region IIdentity Members
-
- /// <summary>
- /// Gets the type of authentication used.
- /// </summary>
- /// <value>The constant "OAuth"</value>
- /// <returns>
- /// The type of authentication used to identify the user.
- /// </returns>
- public string AuthenticationType {
- get { return "OAuth"; }
- }
-
- /// <summary>
- /// Gets a value indicating whether the user has been authenticated.
- /// </summary>
- /// <value>The value <c>true</c></value>
- /// <returns>true if the user was authenticated; otherwise, false.
- /// </returns>
- public bool IsAuthenticated {
- get { return true; }
- }
-
- /// <summary>
- /// Gets the name of the user who authorized the OAuth token the consumer is using for authorization.
- /// </summary>
- /// <returns>
- /// The name of the user on whose behalf the code is running.
- /// </returns>
- public string Name { get; private set; }
-
- #endregion
- }
-}
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
- }
-}