Authorization is the responsibility of the service level. You cannot change it by endpoint.
At a high level you should:
- Define endpoint bindings to use the various security configurations you need (what you did)
- Create a custom ClaimsAuthenticationManager to assign claims based on different identifiers that will be represented by different relationships.
Conceptually, the ClaimsAuthenticationManager acts as "in STS", adding claims based on different credentials. From there you provide authorization on your service.
I am not aware of any custom authorization managers that you want, you want to write your own (if you prove that I'm wrong, write what you find).
ClaimsAuthenticationManager requires the Windows Identity Framework to implement. The following is a summary of the .NET 4.0 implementation that I used (this might be easier in 4.5). I apologize that the code does not compile and is not complete, but I do not need time to hide everything for a public message. This should point you in the right direction.
Inherit from Microsoft.IdentityModel.Claims.ClaimsAuthenticationManager and implement Authenticate (). It should look something like this:
namespace MyWCF.ClaimsInjection { public class ClaimsAuthenticationManager : Microsoft.IdentityModel.Claims.ClaimsAuthenticationManager { public override IClaimsPrincipal Authenticate(string resourceName, IClaimsPrincipal incomingPrincipal) { if (incomingPrincipal == null) { throw new ArgumentNullException("incomingPrincipal", "ClaimInjectionClaimsAuthenticationManager requires a principal."); } IClaimsPrincipal resultPrincipal = base.Authenticate(resourceName, incomingPrincipal); foreach (IIdentity identity in resultPrincipal.Identities) { if (identity is ClaimsIdentity) {
Now just install the user manager (including only the interesting parts):
<configuration> <configSections> <section name="microsoft.identityModel" type="Microsoft.IdentityModel.Configuration.MicrosoftIdentityModelSection, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> </configSections> <system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="serviceBehavior"> <federatedServiceHostConfiguration /> </behavior> </serviceBehaviors> </behaviors> <extensions> <behaviorExtensions> <add name="federatedServiceHostConfiguration" type="Microsoft.IdentityModel.Configuration.ConfigureServiceHostBehaviorExtensionElement, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> </behaviorExtensions> </extensions> </system.serviceModel> <microsoft.identityModel> <service> <claimsAuthenticationManager type="MyWCF.ClaimsAuthenticationManager, MyWCF"/> </service> </microsoft.identityModel> </configuration>