I'm using the Authentication feature in ServiceStack and configured the Auth plugin to use CredentialsAuthProvider. On the generated metadata page, ServiceStack shows the following operations:
I'm only using the Auth operation, why I would like to remove the roles operations to avoid that the readers of this page get confused on how to use the API. Is this possible?
you could do the following which will remove only AssignRoles and UnAssignRoles
AuthFeature authFeature = new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] { new BasicAuthProvider() });
authFeature.IncludeAssignRoleServices = false;
Plugins.Add(authFeature);
When in doubt look to see if there's a description in the Plugins wiki or for this, the dedicated Authentication page.
Each plugin has properties which override it's behavior, in this case just override it with the routes that are available:
Plugins.Add(new AuthFeature(() => new AuthUserSession()) {
IncludeAssignRoleServices = false
});
Which is a short-hand for:
Plugins.Add(new AuthFeature(() => new AuthUserSession(),
new IAuthProvider[] { ... },
ServiceRoutes = new Dictionary<Type, string[]> {
{ typeof(AuthService), new[]{"/auth", "/auth/{provider}"} },
//Omit the Un/AssignRoles service definitions here.
}
));
The source code for the AuthFeature is also useful to see the defaults of each property.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With