Skip to content

Commit

Permalink
Deployed 04d2b08 with MkDocs version: 1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dunossauro committed Oct 2, 2024
1 parent 6ad9780 commit 77dc9c7
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 44 deletions.
4 changes: 2 additions & 2 deletions 06/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2413,7 +2413,7 @@ <h2 id="protegendo-os-endpoints">Protegendo os Endpoints</h2>
<li>Nessa validação é testada se o token é um token JWT válido. Caso não seja, o erro também será levantado.</li>
<li>Nossa última validação checa, após de garantir que existe <code>username</code>, se ele está presente em nossa base de dados. Caso não, o erro será levantado. </li>
</ol>
<p>Aqui, a função <code>get_current_user</code> é definida como assíncrona, indicando que ela pode realizar operações de IO (como consultar um banco de dados) de forma não bloqueante. Esta função aceita dois argumentos: <code>session</code> e <code>token</code>. O <code>session</code> é obtido através da função <code>get_session</code> (não mostrada aqui), que deve retornar uma sessão de banco de dados ativa. O <code>token</code> é obtido do header de autorização da requisição, que é esperado ser do tipo Bearer (indicado pelo esquema OAuth2).</p>
<p>Aqui, a função <code>get_current_user</code> aceita dois argumentos: <code>session</code> e <code>token</code>. O <code>session</code> é obtido através da função <code>get_session</code> (não mostrada aqui), que deve retornar uma sessão de banco de dados ativa. O <code>token</code> é obtido do header de autorização da requisição, que é esperado ser do tipo Bearer (indicado pelo esquema OAuth2).</p>
<p>A variável <code>credentials_exception</code> é definida como uma exceção HTTP que será lançada sempre que houver um problema com as credenciais fornecidas pelo usuário. O status 401 indica que a autenticação falhou e a mensagem "Could not validate credentials" é retornada ao cliente. Além disso, um cabeçalho 'WWW-Authenticate' é incluído na resposta, indicando que o cliente deve fornecer autenticação.</p>
<p>No bloco <code>try</code>, tentamos decodificar o token JWT usando a chave secreta e o algoritmo especificado. O token decodificado é armazenado na variável <code>payload</code>. Extraímos o campo 'sub' (normalmente usado para armazenar o identificador do usuário no token JWT) e verificamos se ele existe. Se não, lançamos a exceção <code>credentials_exception</code>. Em seguida, criamos um objeto <code>TokenData</code> com o username.</p>
<p>Por fim, realizamos uma consulta ao banco de dados para encontrar o usuário com o e-mail correspondente ao username contido no token. <code>session.scalar</code> é usado para retornar a primeira coluna do primeiro resultado da consulta. Se nenhum usuário for encontrado, lançamos a exceção <code>credentials_exception</code>. Se um usuário for encontrado, retornamos esse usuário.</p>
Expand Down Expand Up @@ -2752,7 +2752,7 @@ <h2 id="conclusao">Conclusão</h2>
<span class="md-icon" title="Última atualização">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 13.1c-.1 0-.3.1-.4.2l-1 1 2.1 2.1 1-1c.2-.2.2-.6 0-.8l-1.3-1.3c-.1-.1-.2-.2-.4-.2m-1.9 1.8-6.1 6V23h2.1l6.1-6.1zM12.5 7v5.2l4 2.4-1 1L11 13V7zM11 21.9c-5.1-.5-9-4.8-9-9.9C2 6.5 6.5 2 12 2c5.3 0 9.6 4.1 10 9.3-.3-.1-.6-.2-1-.2s-.7.1-1 .2C19.6 7.2 16.2 4 12 4c-4.4 0-8 3.6-8 8 0 4.1 3.1 7.5 7.1 7.9l-.1.2z"/></svg>
</span>
<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">7 de setembro de 2024</span>
<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">2 de outubro de 2024</span>
</span>


Expand Down
6 changes: 3 additions & 3 deletions 08/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1698,7 +1698,7 @@ <h3 id="testando-a-alteracao-de-um-usuario-nao-autorizado">Testando a alteraçã
<p>Para testar isso, criaremos um novo teste chamado test_update_user_with_wrong_user.</p>
<p></p><div class="language-python highlight"><span class="filename">tests/test_users.py</span><pre><span></span><code><span id="__span-0-1"><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="k">def</span> <span class="nf">test_update_user_with_wrong_user</span><span class="p">(</span><span class="n">client</span><span class="p">,</span> <span class="n">user</span><span class="p">,</span> <span class="n">token</span><span class="p">):</span>
</span><span id="__span-0-2"><a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="n">response</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">put</span><span class="p">(</span>
</span><span id="__span-0-3"><a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="sa">f</span><span class="s1">'/users/</span><span class="si">{</span><span class="n">user</span><span class="o">.</span><span class="n">id</span><span class="si">}</span><span class="s1">'</span><span class="p">,</span>
</span><span id="__span-0-3"><a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="sa">f</span><span class="s1">'/users/</span><span class="si">{</span><span class="n">user</span><span class="o">.</span><span class="n">id</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="si">}</span><span class="s1">'</span><span class="p">,</span>
</span><span id="__span-0-4"><a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="n">headers</span><span class="o">=</span><span class="p">{</span><span class="s1">'Authorization'</span><span class="p">:</span> <span class="sa">f</span><span class="s1">'Bearer </span><span class="si">{</span><span class="n">token</span><span class="si">}</span><span class="s1">'</span><span class="p">},</span>
</span><span id="__span-0-5"><a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="n">json</span><span class="o">=</span><span class="p">{</span>
</span><span id="__span-0-6"><a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="s1">'username'</span><span class="p">:</span> <span class="s1">'bob'</span><span class="p">,</span>
Expand Down Expand Up @@ -2215,7 +2215,7 @@ <h2 id="conclusao">Conclusão</h2>
<span class="md-icon" title="Última atualização">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 13.1c-.1 0-.3.1-.4.2l-1 1 2.1 2.1 1-1c.2-.2.2-.6 0-.8l-1.3-1.3c-.1-.1-.2-.2-.4-.2m-1.9 1.8-6.1 6V23h2.1l6.1-6.1zM12.5 7v5.2l4 2.4-1 1L11 13V7zM11 21.9c-5.1-.5-9-4.8-9-9.9C2 6.5 6.5 2 12 2c5.3 0 9.6 4.1 10 9.3-.3-.1-.6-.2-1-.2s-.7.1-1 .2C19.6 7.2 16.2 4 12 4c-4.4 0-8 3.6-8 8 0 4.1 3.1 7.5 7.1 7.9l-.1.2z"/></svg>
</span>
<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">17 de julho de 2024</span>
<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">2 de outubro de 2024</span>
</span>


Expand All @@ -2230,7 +2230,7 @@ <h2 id="conclusao">Conclusão</h2>

</span>
<nav>
dunossauro, Julio Formiga, RWallan, Gabriel
dunossauro, Julio Formiga, RWallan, Gabriel, Ricardo Oliveira
</nav>
</span>

Expand Down
2 changes: 1 addition & 1 deletion search/search_index.json

Large diffs are not rendered by default.

76 changes: 38 additions & 38 deletions sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,154 +2,154 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://fastapidozero.dunossauro.com/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/01/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/02/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/03/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/04/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/05/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/06/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/07/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/08/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/09/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/10/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/11/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/12/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/13/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/14/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/apendices/a_instalacoes/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/apendices/b_proximos_passos/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/aulas/sincronas/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/exercicios_resolvidos/aula_01/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/exercicios_resolvidos/aula_02/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/exercicios_resolvidos/aula_03/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/exercicios_resolvidos/aula_04/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/exercicios_resolvidos/aula_05/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/exercicios_resolvidos/aula_06/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/projetos/projetos_finais/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/projetos/repositorios/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/quizes/aula_01/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/quizes/aula_02/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/quizes/aula_03/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/quizes/aula_04/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/quizes/aula_05/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/quizes/aula_06/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/quizes/aula_07/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/quizes/aula_08/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/quizes/aula_09/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/quizes/aula_10/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/quizes/aula_11/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
<url>
<loc>https://fastapidozero.dunossauro.com/quizes/aula_12/</loc>
<lastmod>2024-09-30</lastmod>
<lastmod>2024-10-02</lastmod>
</url>
</urlset>
Binary file modified sitemap.xml.gz
Binary file not shown.

0 comments on commit 77dc9c7

Please sign in to comment.