<p>I am using a WCF service and a net.tcp endpoint with serviceAuthentication's principal PermissionMode set to UseWindowsGroups.</p>

<p>Currently in the implementation of the service i am using the PrincipalPermission attribute to set the role requirements for each method. </p>

<pre><code>        [PrincipalPermission(SecurityAction.Demand, Role = "Administrators")]
        [OperationBehavior(Impersonation = ImpersonationOption.Required)]
        public string method1()
</code></pre>

<p>I am trying to do pretty much the same exact thing, except have the configuration for the role set in the app.config. Is there any way to do this and still be using windows groups authentication?</p>

<p>Thanks</p>

If I understood well you want to select the role at runtime. This can be done with a
permission
demand within the WCF operation. E.g.
```
```
public string method1()
{
    PrincipalPermission p = new PrincipalPermission(null, "Administrators");
    p.Demand();
    ...
```
```