Authentication and Authorization with ServiceStack.MVC

霸气de小男生 提交于 2020-01-02 10:06:05

问题


AuthorizeAttribute is useless while using ServiceStack.Mvc

AuthenticateAttribute is for DTO objects.

There is no sample for AccountController with ServiceStack, Signout is not working in SocialBootStrapApi.

Where is the basic Login,Logout,Authorize with Roles samples with ServiceStack.Mvc? (Not single page application, classic Asp.Net Mvc)


回答1:


ServiceStack doesn't use the ASP.NET's or MVC's Authentication or anything that relies on it e.g. MVC's AccountController, it uses its own Authentication Provider.

AuthenticateAttribute and any other ServiceStack Request or Response Filter attributes can in fact be used on both the DTO's and the Service.

If you inherit from ServiceStackController then you can use ServiceStack's Attribute Filters in [ExecuteServiceStackFilters] do get executed, e.g.

  • [Authenticate]
  • [RequiredRole]
  • [RequiredPermission]


来源:https://stackoverflow.com/questions/11236728/authentication-and-authorization-with-servicestack-mvc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!