{"id":6205,"date":"2017-03-01T18:40:47","date_gmt":"2017-03-01T18:40:47","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/premier_developer\/?p=6205"},"modified":"2019-02-14T20:23:58","modified_gmt":"2019-02-15T03:23:58","slug":"discovering-authorizeattribute-role-names","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/premier-developer\/discovering-authorizeattribute-role-names\/","title":{"rendered":"Discovering AuthorizeAttribute role names"},"content":{"rendered":"<p>In this post, Senior Consultant,\u00a0<a href=\"https:\/\/blogs.msdn.microsoft.com\/mrochon\/\">Marius Rochon\u00a0<\/a>showcases how to discover &#8216;AuthorizeAttribute&#8217; role names.<\/p>\n<hr \/>\n<p>The AuthorizeAttribute is used in ASP.NET code to decorate controller\u00a0classes and methods which require authorization, e.g.<\/p>\n<p><span> [<\/span><strong><span>Authorize<\/span><\/strong><span>(Roles =<\/span><span>\u201cadmin\u201d<\/span><span>)]<\/span><\/p>\n<p><span><\/span><span>public<\/span><span> <\/span><span>class<\/span><span> <\/span><span>HomeController<\/span><span> : <\/span><span>Controller<\/span><\/p>\n<p>{<\/p>\n<p>Meaning that to call any method in this class, the user needs to have a role claim with the value \u2018admin\u2019. With many controllers and methods the number of roles used and their assignment to methods may become an administrative issue. It may not be easily discoverable what is the complete list of roles the application uses or\u00a0what is the complete set of methods enabled by a role.<\/p>\n<p><a href=\"https:\/\/blogs.msdn.microsoft.com\/mrochon\/2017\/02\/20\/discovering-authorizeattribute-role-names\/\">Continue reading on\u00a0Marius&#8217;s blog\u2026<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post, Senior Consultant,\u00a0Marius Rochon\u00a0showcases how to discover &#8216;AuthorizeAttribute&#8217; role names. The AuthorizeAttribute is used in ASP.NET code to decorate controller\u00a0classes and methods which require authorization, e.g. [Authorize(Roles =\u201cadmin\u201d)] public class HomeController : Controller { Meaning that to call any method in this class, the user needs to have a role claim with the [&hellip;]<\/p>\n","protected":false},"author":583,"featured_media":37840,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1,96],"tags":[],"class_list":["post-6205","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-permierdev","category-security"],"acf":[],"blog_post_summary":"<p>In this post, Senior Consultant,\u00a0Marius Rochon\u00a0showcases how to discover &#8216;AuthorizeAttribute&#8217; role names. The AuthorizeAttribute is used in ASP.NET code to decorate controller\u00a0classes and methods which require authorization, e.g. [Authorize(Roles =\u201cadmin\u201d)] public class HomeController : Controller { Meaning that to call any method in this class, the user needs to have a role claim with the [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/6205","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/users\/583"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/comments?post=6205"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/6205\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media\/37840"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media?parent=6205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/categories?post=6205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/tags?post=6205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}