summaryrefslogtreecommitdiffstats
path: root/samples/OAuthServiceProvider/App_Code/OAuthAuthorizationManager.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-09-09 07:04:26 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2009-09-09 07:04:26 -0700
commit637fb7dd7c44f4a36e45bc18122cf035038c775f (patch)
tree1ef5f741c76b06fb1c2ecc0ebe1e64053a40d9f2 /samples/OAuthServiceProvider/App_Code/OAuthAuthorizationManager.cs
parentc0f1c849e0ee21f3d7f126cd7b56fb4d3bfaf3ce (diff)
parent6513d4d2b23e925d12b79e3864ea610c538a48e9 (diff)
downloadDotNetOpenAuth-637fb7dd7c44f4a36e45bc18122cf035038c775f.zip
DotNetOpenAuth-637fb7dd7c44f4a36e45bc18122cf035038c775f.tar.gz
DotNetOpenAuth-637fb7dd7c44f4a36e45bc18122cf035038c775f.tar.bz2
Merge branch 'v3.2' into gsa
Diffstat (limited to 'samples/OAuthServiceProvider/App_Code/OAuthAuthorizationManager.cs')
-rw-r--r--samples/OAuthServiceProvider/App_Code/OAuthAuthorizationManager.cs9
1 files changed, 8 insertions, 1 deletions
diff --git a/samples/OAuthServiceProvider/App_Code/OAuthAuthorizationManager.cs b/samples/OAuthServiceProvider/App_Code/OAuthAuthorizationManager.cs
index 1ec2cb5..8589932 100644
--- a/samples/OAuthServiceProvider/App_Code/OAuthAuthorizationManager.cs
+++ b/samples/OAuthServiceProvider/App_Code/OAuthAuthorizationManager.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IdentityModel.Policy;
using System.Linq;
+using System.Security.Principal;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Security;
@@ -27,10 +28,12 @@ public class OAuthAuthorizationManager : ServiceAuthorizationManager {
if (auth != null) {
var accessToken = Global.DataContext.OAuthTokens.Single(token => token.Token == auth.AccessToken);
- var policy = new OAuthPrincipalAuthorizationPolicy(sp.CreatePrincipal(auth));
+ var principal = sp.CreatePrincipal(auth);
+ var policy = new OAuthPrincipalAuthorizationPolicy(principal);
var policies = new List<IAuthorizationPolicy> {
policy,
};
+
var securityContext = new ServiceSecurityContext(policies.AsReadOnly());
if (operationContext.IncomingMessageProperties.Security != null) {
operationContext.IncomingMessageProperties.Security.ServiceSecurityContext = securityContext;
@@ -40,6 +43,10 @@ public class OAuthAuthorizationManager : ServiceAuthorizationManager {
};
}
+ securityContext.AuthorizationContext.Properties["Identities"] = new List<IIdentity> {
+ principal.Identity,
+ };
+
// Only allow this method call if the access token scope permits it.
string[] scopes = accessToken.Scope.Split('|');
if (scopes.Contains(operationContext.IncomingMessageHeaders.Action)) {