diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-06-07 21:29:29 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-06-07 21:29:29 -0700 |
commit | b3a35b9ae0823dda35bb07b404c9c09fec09402a (patch) | |
tree | b58aaf62cf23c1e2c06a0f1d5f13ab899fff6a04 /samples/OAuthServiceProvider/Code | |
parent | 8ed398b9151c8fc140379756bd3bd546a46daf05 (diff) | |
download | DotNetOpenAuth-b3a35b9ae0823dda35bb07b404c9c09fec09402a.zip DotNetOpenAuth-b3a35b9ae0823dda35bb07b404c9c09fec09402a.tar.gz DotNetOpenAuth-b3a35b9ae0823dda35bb07b404c9c09fec09402a.tar.bz2 |
Lots of StyleCop work, and one bug fix (can you find it? <g>)
Diffstat (limited to 'samples/OAuthServiceProvider/Code')
3 files changed, 10 insertions, 11 deletions
diff --git a/samples/OAuthServiceProvider/Code/Global.cs b/samples/OAuthServiceProvider/Code/Global.cs index a43cf57..fd7d475 100644 --- a/samples/OAuthServiceProvider/Code/Global.cs +++ b/samples/OAuthServiceProvider/Code/Global.cs @@ -22,6 +22,8 @@ /// </summary> public static log4net.ILog Logger = log4net.LogManager.GetLogger("DotNetOpenAuth.OAuthServiceProvider"); + public static WebServerAuthorizationServer AuthorizationServer = new WebServerAuthorizationServer(new OAuth2AuthorizationServer()); + /// <summary> /// Gets the transaction-protected database connection for the current request. /// </summary> @@ -58,8 +60,6 @@ set { HttpContext.Current.Session["authrequest"] = value; } } - public static WebServerAuthorizationServer AuthorizationServer = new WebServerAuthorizationServer(new OAuth2AuthorizationServer()); - private static DataClassesDataContext dataContextSimple { get { if (HttpContext.Current != null) { diff --git a/samples/OAuthServiceProvider/Code/OAuth2AuthorizationServer.cs b/samples/OAuthServiceProvider/Code/OAuth2AuthorizationServer.cs index 75778f5..e281b07 100644 --- a/samples/OAuthServiceProvider/Code/OAuth2AuthorizationServer.cs +++ b/samples/OAuthServiceProvider/Code/OAuth2AuthorizationServer.cs @@ -11,9 +11,9 @@ using DotNetOpenAuth.OAuthWrap.ChannelElements; internal class OAuth2AuthorizationServer : IAuthorizationServer { - private static readonly byte[] secret; + internal static readonly RSAParameters AsymmetricKey; - internal static readonly RSAParameters asymmetricKey; + private static readonly byte[] secret; private readonly INonceStore nonceStore = new DatabaseNonceStore(); @@ -23,7 +23,7 @@ secret = new byte[16]; crypto.GetBytes(secret); - asymmetricKey = new RSACryptoServiceProvider().ExportParameters(true); + AsymmetricKey = new RSACryptoServiceProvider().ExportParameters(true); } #region Implementation of IAuthorizationServer @@ -37,7 +37,7 @@ } public RSAParameters AccessTokenSigningPrivateKey { - get { return asymmetricKey; } + get { return AsymmetricKey; } } public IConsumerDescription GetClient(string clientIdentifier) { diff --git a/samples/OAuthServiceProvider/Code/OAuthAuthorizationManager.cs b/samples/OAuthServiceProvider/Code/OAuthAuthorizationManager.cs index a48288a..92038bd 100644 --- a/samples/OAuthServiceProvider/Code/OAuthAuthorizationManager.cs +++ b/samples/OAuthServiceProvider/Code/OAuthAuthorizationManager.cs @@ -7,10 +7,9 @@ using System.ServiceModel; using System.ServiceModel.Channels; using System.ServiceModel.Security; - using DotNetOpenAuth; using DotNetOpenAuth.OAuth; - using DotNetOpenAuth.OAuthWrap; using DotNetOpenAuth.OAuth.ChannelElements; + using DotNetOpenAuth.OAuthWrap; /// <summary> /// A WCF extension to authenticate incoming messages using OAuth. @@ -28,7 +27,7 @@ Uri requestUri = operationContext.RequestContext.RequestMessage.Properties["OriginalHttpRequestUri"] as Uri; try { - var principal = VerifyOAuth2(httpDetails, requestUri); + var principal = this.VerifyOAuth2(httpDetails, requestUri); if (principal != null) { var policy = new OAuthPrincipalAuthorizationPolicy(principal); var policies = new List<IAuthorizationPolicy> { @@ -77,8 +76,8 @@ // we use the same public/private key. var resourceServer = new ResourceServer( new StandardAccessTokenAnalyzer( - OAuth2AuthorizationServer.asymmetricKey, - OAuth2AuthorizationServer.asymmetricKey)); + OAuth2AuthorizationServer.AsymmetricKey, + OAuth2AuthorizationServer.AsymmetricKey)); string username, scope; var error = resourceServer.VerifyAccess(new DotNetOpenAuth.Messaging.HttpRequestInfo(httpDetails, requestUri), out username, out scope); |