diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-04-19 07:09:32 -0400 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-04-19 07:09:32 -0400 |
commit | 668c50fd19dc633bd367ac8ace37df8b5f9a5881 (patch) | |
tree | 8ab71b553fa22e12aae6817b3c6fab93acdd31df /samples/OAuthServiceProvider/Code/Utilities.cs | |
parent | fef932af78eac2b775452c4a851e84a813027548 (diff) | |
download | DotNetOpenAuth-668c50fd19dc633bd367ac8ace37df8b5f9a5881.zip DotNetOpenAuth-668c50fd19dc633bd367ac8ace37df8b5f9a5881.tar.gz DotNetOpenAuth-668c50fd19dc633bd367ac8ace37df8b5f9a5881.tar.bz2 |
Updated OAuth C and SP samples to use standard WAP namespaces.
Diffstat (limited to 'samples/OAuthServiceProvider/Code/Utilities.cs')
-rw-r--r-- | samples/OAuthServiceProvider/Code/Utilities.cs | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/samples/OAuthServiceProvider/Code/Utilities.cs b/samples/OAuthServiceProvider/Code/Utilities.cs index 2c25fe8..a225650 100644 --- a/samples/OAuthServiceProvider/Code/Utilities.cs +++ b/samples/OAuthServiceProvider/Code/Utilities.cs @@ -1,26 +1,28 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Principal; -using System.Web; +namespace OAuthServiceProvider.Code { + using System; + using System.Collections.Generic; + using System.Linq; + using System.Security.Principal; + using System.Web; -/// <summary> -/// Extension methods and other helpful utility methods. -/// </summary> -public static class Utilities { /// <summary> - /// Gets the database entity representing the user identified by a given <see cref="IIdentity"/> instance. + /// Extension methods and other helpful utility methods. /// </summary> - /// <param name="identity">The identity of the user.</param> - /// <returns> - /// The database object for that user; or <c>null</c> if the user could not - /// be found or if <paramref name="identity"/> is <c>null</c> or represents an anonymous identity. - /// </returns> - public static User GetUser(this IIdentity identity) { - if (identity == null || !identity.IsAuthenticated) { - return null; - } + public static class Utilities { + /// <summary> + /// Gets the database entity representing the user identified by a given <see cref="IIdentity"/> instance. + /// </summary> + /// <param name="identity">The identity of the user.</param> + /// <returns> + /// The database object for that user; or <c>null</c> if the user could not + /// be found or if <paramref name="identity"/> is <c>null</c> or represents an anonymous identity. + /// </returns> + public static User GetUser(this IIdentity identity) { + if (identity == null || !identity.IsAuthenticated) { + return null; + } - return Global.DataContext.Users.SingleOrDefault(user => user.OpenIDClaimedIdentifier == identity.Name); + return Global.DataContext.Users.SingleOrDefault(user => user.OpenIDClaimedIdentifier == identity.Name); + } } -} +}
\ No newline at end of file |