diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-08-31 22:36:07 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-08-31 22:36:07 -0700 |
commit | 36b1ba3c75d060fa71f6f15582b90e7f70292ddc (patch) | |
tree | dfd32367b587453369a4d58e75482d1a9ca23556 /samples/OAuthServiceProvider/App_Code/OAuthAuthorizationManager.cs | |
parent | 5ad3b4e1fdc50cbcebfde7fd0f5cd0ef629d874a (diff) | |
parent | 22cd5b99d428271139aa0005d5b3462979cc2720 (diff) | |
download | DotNetOpenAuth-36b1ba3c75d060fa71f6f15582b90e7f70292ddc.zip DotNetOpenAuth-36b1ba3c75d060fa71f6f15582b90e7f70292ddc.tar.gz DotNetOpenAuth-36b1ba3c75d060fa71f6f15582b90e7f70292ddc.tar.bz2 |
Merge branch 'v3.2'
Conflicts:
src/DotNetOpenAuth.vsmdi
src/DotNetOpenAuth/OpenId/Identifier.cs
Diffstat (limited to 'samples/OAuthServiceProvider/App_Code/OAuthAuthorizationManager.cs')
-rw-r--r-- | samples/OAuthServiceProvider/App_Code/OAuthAuthorizationManager.cs | 9 |
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)) { |