1

Simple question, I've got the code below to specify the routes for my user authentication using a custom CredentialsAuthProvider (put together using what I found in the documentation)

// inside 'Configure()'....
Dictionary<Type, string[]> serviceRoutes = new Dictionary<Type, string[]>();
serviceRoutes.Add(typeof(AuthService), new[] { "/user/auth" });           
AuthFeature authFeature = new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] {
    new myCompany.web.JSONService.myCompanyCredentialsAuthProvider() 
});
authFeature.IncludeAssignRoleServices = false;
authFeature.ServiceRoutes = serviceRoutes; //specify manual auth routes            
Plugins.Add(authFeature);

which creates a route of /user/auth, what I'd also like is a route like this :

/user/logout

but there is very little in the documentation about logout functionality. Is this a custom route I have to build into my service like all my other API calls, or is there a configuration option I can use?

Also, i'm currently using the swagger plugin to document and test my service, but it shows me the /user/auth route as 'get' enabled, I'd like to restrict it to 'post' verb only, if that's possible? Secondary question, mostly want to know correct way to implement logout

4

1 回答 1

1

AuthFeature创建一个路由,您/auth/logout可以使用 GET 或 POST 来注销它

于 2013-09-19T14:37:01.257 回答