summaryrefslogtreecommitdiffstats
path: root/samples/OAuthResourceServer/Code/OAuthAuthorizationManager.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2011-04-07 08:01:44 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2011-04-07 08:01:44 -0700
commitcb6027d9171f1411965e070a328e090594e3231c (patch)
tree2e12c640af6137b81fd765d19fdae8334d494d1f /samples/OAuthResourceServer/Code/OAuthAuthorizationManager.cs
parent7517491e79bb91241acbd46292006e8c999ec211 (diff)
downloadDotNetOpenAuth-cb6027d9171f1411965e070a328e090594e3231c.zip
DotNetOpenAuth-cb6027d9171f1411965e070a328e090594e3231c.tar.gz
DotNetOpenAuth-cb6027d9171f1411965e070a328e090594e3231c.tar.bz2
Fixed static field initialization.
Diffstat (limited to 'samples/OAuthResourceServer/Code/OAuthAuthorizationManager.cs')
-rw-r--r--samples/OAuthResourceServer/Code/OAuthAuthorizationManager.cs17
1 files changed, 9 insertions, 8 deletions
diff --git a/samples/OAuthResourceServer/Code/OAuthAuthorizationManager.cs b/samples/OAuthResourceServer/Code/OAuthAuthorizationManager.cs
index 4b47dd5..0c1953d 100644
--- a/samples/OAuthResourceServer/Code/OAuthAuthorizationManager.cs
+++ b/samples/OAuthResourceServer/Code/OAuthAuthorizationManager.cs
@@ -64,16 +64,17 @@
private static IPrincipal VerifyOAuth2(HttpRequestMessageProperty httpDetails, Uri requestUri) {
// for this sample where the auth server and resource server are the same site,
// we use the same public/private key.
- var resourceServer = new ResourceServer(
- new StandardAccessTokenAnalyzer(
- Global.AuthorizationServerSigningServiceProvider,
- Global.ResourceServerEncryptionServiceProvider));
+ using (var signing = Global.CreateAuthorizationServerSigningServiceProvider()) {
+ using (var encrypting = Global.CreateResourceServerEncryptionServiceProvider()) {
+ var resourceServer = new ResourceServer(new StandardAccessTokenAnalyzer(signing, encrypting));
- IPrincipal result;
- var error = resourceServer.VerifyAccess(new HttpRequestInfo(httpDetails, requestUri), out result);
+ IPrincipal result;
+ var error = resourceServer.VerifyAccess(new HttpRequestInfo(httpDetails, requestUri), out result);
- // TODO: return the prepared error code.
- return error != null ? null : result;
+ // TODO: return the prepared error code.
+ return error != null ? null : result;
+ }
+ }
}
}
}