security - Authorize attribute between requests -
this page describes how can use [authorize]
attribute restrict access controllers , actions authenticated or authorized users.
the authentication done setting thread.currentprincipal
, allows access restricted controllers/actions provided user in required roles.
when following method, thread.currentprincipal
need set each request (e.g. in message handler), or web api have way of maintaining principal between requests? (as far know, web api stateless , there no session, i'm checking.)
furthermore, if current principal not maintained between sessions, advantage [authorize]
attribute provide on writing own custom access control scheme?
you correct thread.currentprincipal
needs set each request in message handler since server stateless.
some benefits of authorize attribute
- allows add authorization on specific methods or entire controller
- you specify multiple authorization attributes on single action
- you can use
[allowanonymousattribute]
disable authorization action - allows authorize on role claims or user claims
- provides valuable overrides determine authorization
Comments
Post a Comment