{"id":3655,"date":"2017-05-31T13:31:31","date_gmt":"2017-05-31T20:31:31","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=3655"},"modified":"2025-06-13T19:29:01","modified_gmt":"2025-06-14T02:29:01","slug":"authentication-authorization-rbac-net","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/pt\/authentication-authorization-rbac-net\/","title":{"rendered":"Autentica\u00e7\u00e3o e autoriza\u00e7\u00e3o com RBAC em .NET"},"content":{"rendered":"<div class=\"paragraph\">\n<p>A autentica\u00e7\u00e3o e a autoriza\u00e7\u00e3o foram amplamente aprimoradas no Couchbase Server 5.0. H\u00e1 algum tempo, estamos escrevendo sobre os novos recursos RBAC na visualiza\u00e7\u00e3o para desenvolvedores.<\/p>\n<\/div>\n<div class=\"ulist\">\n<ul>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/pt\/authentication-authorization-rbac\/\">Autentica\u00e7\u00e3o e autoriza\u00e7\u00e3o com RBAC<\/a> - introdu\u00e7\u00e3o \/ parte 1<\/li>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/pt\/authentication-authorization-rbac-part-2\/\">Autentica\u00e7\u00e3o e autoriza\u00e7\u00e3o com RBAC (Parte 2)<\/a> - gerenciamento de usu\u00e1rios<\/li>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/pt\/new-sdk-authentication\/\">M\u00e9todos de autentica\u00e7\u00e3o do SDK aprimorados - Couchbase 5.0<\/a> - uma introdu\u00e7\u00e3o com Python, Java, PHP e .NET<\/li>\n<\/ul>\n<\/div>\n<div class=\"paragraph\">\n<p>Agora que o Couchbase Server 5.0 Beta foi lan\u00e7ado, estou escrevendo uma postagem mais detalhada no blog sobre como usar o Couchbase .NET SDK junto com esses novos recursos.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p><em>Os exemplos de c\u00f3digo completo usados nesta postagem do blog s\u00e3o <a href=\"https:\/\/github.com\/couchbaselabs\/blog-source-code\/tree\/master\/Groves\/067RBACandSDK\/src\/rbacsdk\">dispon\u00edvel para voc\u00ea no Github<\/a>.<\/em><\/p>\n<\/div>\n<div class=\"sect1\">\n<h2 id=\"_create_a_bucket\">Criar um balde<\/h2>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>Como mencionei nas postagens anteriores, os dias dos compartimentos com senhas acabaram. O futuro pertence aos usu\u00e1rios - usu\u00e1rios que t\u00eam permiss\u00e3o(s) espec\u00edfica(s) para baldes espec\u00edficos.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Vamos come\u00e7ar criando um bucket. Na interface do usu\u00e1rio do Couchbase, fa\u00e7a login como o administrador que voc\u00ea criou quando instalou o Couchbase. V\u00e1 para \"Buckets\" e clique em \"ADD BUCKET\" (canto superior direito). Voc\u00ea ver\u00e1 a caixa de di\u00e1logo \"Add Data Bucket\". Observe que n\u00e3o h\u00e1 mais um campo \"password\" (nem mesmo em \"Advanced bucket settings\").<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p><span class=\"image\"><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/05\/06701-add-new-bucket.png\" alt=\"Add new bucket - no authentication options anymore\" \/><\/span><\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>D\u00ea um nome ao bucket e uma certa quantidade de mem\u00f3ria e clique em \"Add Bucket\". Agora voc\u00ea tem um bucket. Mas, al\u00e9m de um administrador na interface do usu\u00e1rio, ningu\u00e9m pode acessar esse bucket ainda.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"sect1\">\n<h2 id=\"_create_a_user\">Criar um usu\u00e1rio<\/h2>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>Para obter acesso a esse bucket, \u00e9 necess\u00e1rio criar um usu\u00e1rio. No Couchbase 5.0, os \"usu\u00e1rios\" s\u00e3o um recurso totalmente novo, que traz recursos mais avan\u00e7ados de autentica\u00e7\u00e3o e autoriza\u00e7\u00e3o para o Couchbase Server.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Enquanto ainda estiver conectado como administrador, v\u00e1 para \"Security\" (Seguran\u00e7a) para ver uma lista de usu\u00e1rios. Clique em \"ADD USER\" (canto superior direito).<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p><span class=\"image\"><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/05\/06702-add-new-user-for-authentication.png\" alt=\"Adding a new user for authentication and authorization\" \/><\/span><\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Crie um usu\u00e1rio com o nome e a senha que desejar. Voc\u00ea pode escolher quais fun\u00e7\u00f5es o usu\u00e1rio tem e para quais buckets (quando aplic\u00e1vel). Vamos atribuir a esse usu\u00e1rio fun\u00e7\u00f5es de Data Writer e Data Reader, para o bucket que acabou de ser criado (por exemplo, \"mybucket\"), mas N\u00c3O quaisquer fun\u00e7\u00f5es de Query.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p><span class=\"image\"><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/05\/06703-add-data-roles.png\" alt=\"Adding authorization for data read and data write\" \/><\/span><\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Depois que o usu\u00e1rio \u00e9 adicionado, voc\u00ea pode passar o mouse sobre as fun\u00e7\u00f5es para obter uma descri\u00e7\u00e3o do que a fun\u00e7\u00e3o significa.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p><span class=\"image\"><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/05\/06704-tool-tip-authorization.gif\" alt=\"Authorization tool tip\" \/><\/span><\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"sect1\">\n<h2 id=\"_authentication_and_authorization_with_the_couchbase_net_sdk\">Autentica\u00e7\u00e3o e autoriza\u00e7\u00e3o com o SDK do Couchbase .NET<\/h2>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>Agora que temos um bucket e um usu\u00e1rio, vamos ver como us\u00e1-los com o SDK do .NET.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Comece criando um <code>Aglomerado<\/code> objeto.<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight decode:true\"><code class=\"language-C#\">var cluster = new Cluster(new ClientConfiguration\r\n{\r\n    Servers = new List&lt;Uri&gt; { new Uri(\"https:\/\/localhost:8091\") }\r\n});<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>Voc\u00ea tem um cluster, mas seu programa ainda n\u00e3o foi autenticado. Use um <code>PasswordAuthenticator<\/code> para especificar as credenciais. Em seguida, use esse objeto com o objeto <code>Autenticar<\/code> m\u00e9todo. No exemplo abaixo, estou usando credenciais incorretas.<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight decode:true\"><code class=\"language-C#\">var authenticator = new PasswordAuthenticator(\"myuser\", \"wrongpassword\");\r\ncluster.Authenticate(authenticator);<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>Agora, se eu tentar executar uma opera\u00e7\u00e3o como <code>OpenBucket<\/code> no cluster, uma exce\u00e7\u00e3o \u00e9 lan\u00e7ada.<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight decode:true\"><code class=\"language-C#\">try\r\n{\r\n    var bucket = cluster.OpenBucket(\"mybucket\");\r\n}\r\ncatch (Exception ex)\r\n{\r\n    Console.WriteLine(\"Error getting bucket.\");\r\n    Console.WriteLine(ex.Message);\r\n}<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p><span class=\"image\"><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/05\/06705-authentication-error.png\" alt=\"Error in authentication\" \/><\/span><\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Agora, vamos tentar novamente usando as credenciais corretas. A autentica\u00e7\u00e3o funcionar\u00e1. Mas vamos falar sobre autoriza\u00e7\u00e3o a seguir.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Lembre-se de que s\u00f3 atribu\u00ed a esse usu\u00e1rio fun\u00e7\u00f5es de gravador de dados e leitor de dados (para o mybucket). Portanto, se eu me autenticar e inserir um documento agora, ele funcionar\u00e1.<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight decode:true\"><code class=\"language-C#\">var cluster = new Cluster(new ClientConfiguration\r\n{\r\n    Servers = new List&lt;Uri&gt; { new Uri(\"https:\/\/localhost:8091\") }\r\n});\r\nvar authenticator = new PasswordAuthenticator(\"myuser\", \"password\");\r\ncluster.Authenticate(authenticator);\r\nvar bucket = cluster.OpenBucket(\"mybucket\");\r\n\r\n\/\/ insert a document, this should be allowed\r\nvar result = bucket.Insert(Guid.NewGuid().ToString(), new {foo = \"bar\"});\r\nConsole.WriteLine(\"Insert was successful: \" + result.Success);<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p><span class=\"image\"><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/05\/06706-console-output-authorization.png\" alt=\"Console output when authentication and authorization are valid\" \/><\/span><\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Mas se eu tentasse, por exemplo, executar um <a href=\"https:\/\/www.couchbase.com\/blog\/pt\/products\/n1ql\/\">Consulta N1QL (SQL para JSON)<\/a>ele falhar\u00e1. Isso ocorre porque esse usu\u00e1rio n\u00e3o est\u00e1 autorizado a executar consultas.<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight decode:true\"><code class=\"language-C#\">var queryResult = bucket.Query&lt;int&gt;(\"SELECT COUNT(1) FROM `\" + bucket.Name + \"`\");\r\nConsole.WriteLine(\"Query was successful: \" + queryResult.Success);\r\nqueryResult.Errors.ForEach(e =&gt; Console.WriteLine(\"Error: \" + e.Message));<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>Estou apenas fazendo uma simples <code>COUNT(1)<\/code> consulta de agrega\u00e7\u00e3o. Como esse usu\u00e1rio n\u00e3o est\u00e1 autorizado, eis o que \u00e9 exibido:<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p><span class=\"image\"><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/05\/06707-authorization-query.png\" alt=\"No authorization for running a query\" \/><\/span><\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"sect1\">\n<h2 id=\"_one_more_thing\">Mais uma coisa<\/h2>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>Se voc\u00ea estiver preocupado com o efeito que isso ter\u00e1 na atualiza\u00e7\u00e3o do Couchbase Server 4.x para o Couchbase Server 5.0, aqui vai uma dica. Se voc\u00ea criar um usu\u00e1rio com o mesmo nome do bucket (por exemplo, um bucket chamado \"foo\" e um usu\u00e1rio chamado \"foo\"), as APIs antigas do Couchbase .NET que ainda esperam uma senha de bucket funcionar\u00e3o como antes. Por enquanto, basta atribuir a esse usu\u00e1rio a fun\u00e7\u00e3o \"Cluster Admin\". Essa \u00e9 uma boa solu\u00e7\u00e3o tempor\u00e1ria at\u00e9 que voc\u00ea possa reprojetar seu sistema para usar uma abordagem regimentada para a fun\u00e7\u00e3o.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"sect1\">\n<h2 id=\"_summary\">Resumo<\/h2>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>O Couchbase Server 5.0 j\u00e1 est\u00e1 dispon\u00edvel em vers\u00e3o beta! Esses recursos de autentica\u00e7\u00e3o baseada em fun\u00e7\u00e3o (RBAC) fazem do Couchbase um l\u00edder em seguran\u00e7a de banco de dados de documentos, e estou pessoalmente muito satisfeito que o Couchbase esteja indo nessa dire\u00e7\u00e3o. A seguran\u00e7a \u00e9 importante, mas muitas vezes \u00e9 negligenciada pelos desenvolvedores.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Se voc\u00ea tiver alguma d\u00favida, por favor <a href=\"https:\/\/www.couchbase.com\/blog\/pt\/forums\/\">Fa\u00e7a suas perguntas nos f\u00f3runs do Couchbase<\/a>deixe um coment\u00e1rio abaixo, ou <a href=\"https:\/\/twitter.com\/mgroves\">me envie uma mensagem no Twitter @mgroves<\/a>.<\/p>\n<\/div>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Authentication and authorization are vastly improved in Couchbase Server 5.0. We\u2019ve been blogging about the new RBAC features in the developer preview for a while. Authentication and Authorization with RBAC &#8211; introduction \/ part 1 Authentication and Authorization with RBAC [&hellip;]<\/p>","protected":false},"author":71,"featured_media":3004,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1811,1816,1813],"tags":[1455,1456,1903],"ppma_author":[8937],"class_list":["post-3655","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet","category-couchbase-server","category-security","tag-authentication","tag-authorization","tag-rbac"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Authentication and Authorization with RBAC in .NET - The Couchbase Blog<\/title>\n<meta name=\"description\" content=\"Examples of using the Couchbase .NET SDK with the new authentication and authorization features of Couchbase Server 5.0\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/pt\/authentication-authorization-rbac-net\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Authentication and Authorization with RBAC in .NET\" \/>\n<meta property=\"og:description\" content=\"Examples of using the Couchbase .NET SDK with the new authentication and authorization features of Couchbase Server 5.0\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/pt\/authentication-authorization-rbac-net\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2017-05-31T20:31:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T02:29:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/059-Hero-Key-Locks-Security-Authentication-Authorization-e1657658890360.jpeg\" \/>\n\t<meta property=\"og:image:width\" content=\"1125\" \/>\n\t<meta property=\"og:image:height\" content=\"750\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Matthew Groves\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@mgroves\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Matthew Groves\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/\"},\"author\":{\"name\":\"Matthew Groves\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/3929663e372020321b0152dc4fa65a58\"},\"headline\":\"Authentication and Authorization with RBAC in .NET\",\"datePublished\":\"2017-05-31T20:31:31+00:00\",\"dateModified\":\"2025-06-14T02:29:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/\"},\"wordCount\":694,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/059-Hero-Key-Locks-Security-Authentication-Authorization-e1657658890360.jpeg\",\"keywords\":[\"authentication\",\"authorization\",\"RBAC\"],\"articleSection\":[\".NET\",\"Couchbase Server\",\"Security\"],\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/\",\"name\":\"Authentication and Authorization with RBAC in .NET - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/059-Hero-Key-Locks-Security-Authentication-Authorization-e1657658890360.jpeg\",\"datePublished\":\"2017-05-31T20:31:31+00:00\",\"dateModified\":\"2025-06-14T02:29:01+00:00\",\"description\":\"Examples of using the Couchbase .NET SDK with the new authentication and authorization features of Couchbase Server 5.0\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/059-Hero-Key-Locks-Security-Authentication-Authorization-e1657658890360.jpeg\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/059-Hero-Key-Locks-Security-Authentication-Authorization-e1657658890360.jpeg\",\"width\":1125,\"height\":750,\"caption\":\"NoSQL has built-in security with Couchbase\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Authentication and Authorization with RBAC in .NET\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pt-BR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/3929663e372020321b0152dc4fa65a58\",\"name\":\"Matthew Groves\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/ba51e6aacc53995c323a634e4502ef54\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/70feb1b28a099ad0112b8d21fe1e81e1a4524beed3e20b7f107d5370e85a07ab?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/70feb1b28a099ad0112b8d21fe1e81e1a4524beed3e20b7f107d5370e85a07ab?s=96&d=mm&r=g\",\"caption\":\"Matthew Groves\"},\"description\":\"Matthew D. Groves is a guy who loves to code. It doesn't matter if it's C#, jQuery, or PHP: he'll submit pull requests for anything. He has been coding professionally ever since he wrote a QuickBASIC point-of-sale app for his parent's pizza shop back in the 90s. He currently works as a Senior Product Marketing Manager for Couchbase. His free time is spent with his family, watching the Reds, and getting involved in the developer community. He is the author of AOP in .NET, Pro Microservices in .NET, a Pluralsight author, and a Microsoft MVP.\",\"sameAs\":[\"https:\/\/crosscuttingconcerns.com\",\"https:\/\/x.com\/mgroves\"],\"url\":\"https:\/\/www.couchbase.com\/blog\/pt\/author\/matthew-groves\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Authentication and Authorization with RBAC in .NET - The Couchbase Blog","description":"Exemplos de uso do Couchbase .NET SDK com os novos recursos de autentica\u00e7\u00e3o e autoriza\u00e7\u00e3o do Couchbase Server 5.0","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/pt\/authentication-authorization-rbac-net\/","og_locale":"pt_BR","og_type":"article","og_title":"Authentication and Authorization with RBAC in .NET","og_description":"Examples of using the Couchbase .NET SDK with the new authentication and authorization features of Couchbase Server 5.0","og_url":"https:\/\/www.couchbase.com\/blog\/pt\/authentication-authorization-rbac-net\/","og_site_name":"The Couchbase Blog","article_published_time":"2017-05-31T20:31:31+00:00","article_modified_time":"2025-06-14T02:29:01+00:00","og_image":[{"width":1125,"height":750,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/059-Hero-Key-Locks-Security-Authentication-Authorization-e1657658890360.jpeg","type":"image\/jpeg"}],"author":"Matthew Groves","twitter_card":"summary_large_image","twitter_creator":"@mgroves","twitter_misc":{"Written by":"Matthew Groves","Est. reading time":"5 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/"},"author":{"name":"Matthew Groves","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/3929663e372020321b0152dc4fa65a58"},"headline":"Authentication and Authorization with RBAC in .NET","datePublished":"2017-05-31T20:31:31+00:00","dateModified":"2025-06-14T02:29:01+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/"},"wordCount":694,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/059-Hero-Key-Locks-Security-Authentication-Authorization-e1657658890360.jpeg","keywords":["authentication","authorization","RBAC"],"articleSection":[".NET","Couchbase Server","Security"],"inLanguage":"pt-BR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/","url":"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/","name":"Authentication and Authorization with RBAC in .NET - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/059-Hero-Key-Locks-Security-Authentication-Authorization-e1657658890360.jpeg","datePublished":"2017-05-31T20:31:31+00:00","dateModified":"2025-06-14T02:29:01+00:00","description":"Exemplos de uso do Couchbase .NET SDK com os novos recursos de autentica\u00e7\u00e3o e autoriza\u00e7\u00e3o do Couchbase Server 5.0","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/"]}]},{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/059-Hero-Key-Locks-Security-Authentication-Authorization-e1657658890360.jpeg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/03\/059-Hero-Key-Locks-Security-Authentication-Authorization-e1657658890360.jpeg","width":1125,"height":750,"caption":"NoSQL has built-in security with Couchbase"},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/authentication-authorization-rbac-net\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Authentication and Authorization with RBAC in .NET"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"Blog do Couchbase","description":"Couchbase, o banco de dados NoSQL","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pt-BR"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"Blog do Couchbase","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/3929663e372020321b0152dc4fa65a58","name":"Matthew Groves","image":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/ba51e6aacc53995c323a634e4502ef54","url":"https:\/\/secure.gravatar.com\/avatar\/70feb1b28a099ad0112b8d21fe1e81e1a4524beed3e20b7f107d5370e85a07ab?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/70feb1b28a099ad0112b8d21fe1e81e1a4524beed3e20b7f107d5370e85a07ab?s=96&d=mm&r=g","caption":"Matthew Groves"},"description":"Matthew D. Groves \u00e9 um cara que adora programar. N\u00e3o importa se \u00e9 C#, jQuery ou PHP: ele enviar\u00e1 solicita\u00e7\u00f5es de pull para qualquer coisa. Ele tem programado profissionalmente desde que escreveu um aplicativo de ponto de venda QuickBASIC para a pizzaria de seus pais nos anos 90. Atualmente, ele trabalha como gerente s\u00eanior de marketing de produtos da Couchbase. Seu tempo livre \u00e9 passado com a fam\u00edlia, assistindo aos Reds e participando da comunidade de desenvolvedores. Ele \u00e9 autor de AOP in .NET, Pro Microservices in .NET, autor da Pluralsight e Microsoft MVP.","sameAs":["https:\/\/crosscuttingconcerns.com","https:\/\/x.com\/mgroves"],"url":"https:\/\/www.couchbase.com\/blog\/pt\/author\/matthew-groves\/"}]}},"authors":[{"term_id":8937,"user_id":71,"is_guest":0,"slug":"matthew-groves","display_name":"Matthew Groves","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/70feb1b28a099ad0112b8d21fe1e81e1a4524beed3e20b7f107d5370e85a07ab?s=96&d=mm&r=g","author_category":"","last_name":"Groves","first_name":"Matthew","job_title":"","user_url":"https:\/\/crosscuttingconcerns.com","description":"Matthew D. Groves \u00e9 um cara que adora programar.  N\u00e3o importa se \u00e9 C#, jQuery ou PHP: ele enviar\u00e1 solicita\u00e7\u00f5es de pull para qualquer coisa.  Ele tem programado profissionalmente desde que escreveu um aplicativo de ponto de venda QuickBASIC para a pizzaria de seus pais nos anos 90.  Atualmente, ele trabalha como gerente s\u00eanior de marketing de produtos da Couchbase. Seu tempo livre \u00e9 passado com a fam\u00edlia, assistindo aos Reds e participando da comunidade de desenvolvedores.  Ele \u00e9 autor de AOP in .NET, Pro Microservices in .NET, autor da Pluralsight e Microsoft MVP."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts\/3655","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/users\/71"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/comments?post=3655"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts\/3655\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/media\/3004"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/media?parent=3655"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/categories?post=3655"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/tags?post=3655"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/ppma_author?post=3655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}