updated mcp
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-03-08 17:57:34 +05:30
parent 9191de9dff
commit 0e49f02c4c
167 changed files with 7632 additions and 98942 deletions

View File

@@ -1022,9 +1022,8 @@
<div class="doc doc-contents first">
<p>Authentication request and response models.</p>
<hr />
<h4 id="jwtlib.models.app--summary">Summary</h4>
<h3 id="jwtlib.models.app--summary">Summary</h3>
<p>Authentication request and response models.</p>
<p>This module defines all <strong>typed data models</strong> used by the authentication
library for user registration, login, logout, and token introspection.</p>
@@ -1034,18 +1033,18 @@ library for user registration, login, logout, and token introspection.</p>
<p><strong>Model Categories:</strong></p>
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span></pre></div></td><td class="code"><div><pre><span></span><code>- Request payloads used by authentication workflows
- Public response models exposed to consumers
- Introspection responses used for service-to-service authentication
<span class="normal">3</span></pre></div></td><td class="code"><div><pre><span></span><code>- Request payloads used by authentication workflows.
- Public response models exposed to consumers.
- Introspection responses used for service-to-service authentication.
</code></pre></div></td></tr></table></div>
<p><strong>Design Principles:</strong></p>
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span>
<span class="normal">4</span></pre></div></td><td class="code"><div><pre><span></span><code>- Fully typed (Pydantic v2)
- Serialization-safe
- Framework-agnostic
- Suitable for both internal logic and external adapters
<span class="normal">4</span></pre></div></td><td class="code"><div><pre><span></span><code>- Fully typed (Pydantic v2).
- Serialization-safe.
- Framework-agnostic.
- Suitable for both internal logic and external adapters.
</code></pre></div></td></tr></table></div>
</details>
@@ -1095,7 +1094,7 @@ library for user registration, login, logout, and token introspection.</p>
</td>
<td>
<div class="doc-md-description">
<p>JWT access token to introspect.</p>
<p><code>JWT</code> access token to introspect.</p>
</div>
</td>
</tr>
@@ -1214,7 +1213,7 @@ library for user registration, login, logout, and token introspection.</p>
Bases: <code><a class="autorefs autorefs-internal" title="jwtlib.models.common.IdentityMixin" href="../common/#jwtlib.models.common.IdentityMixin">IdentityMixin</a></code>, <code><a class="autorefs autorefs-internal" title="jwtlib.models.common.PasswordMixin" href="../common/#jwtlib.models.common.PasswordMixin">PasswordMixin</a></code></p>
<p>Payload for authenticating a user and issuing a JWT.</p>
<p>Payload for authenticating a user and issuing a <code>JWT</code>.</p>
<p><span class="doc-section-title">Attributes:</span></p>
@@ -1309,7 +1308,7 @@ library for user registration, login, logout, and token introspection.</p>
</td>
<td>
<div class="doc-md-description">
<p>JWT access token for authenticated requests.</p>
<p><code>JWT</code> access token for authenticated requests.</p>
</div>
</td>
</tr>

View File

@@ -950,9 +950,8 @@
<div class="doc doc-contents first">
<p>Common Pydantic mixins for authentication models.</p>
<hr />
<h4 id="jwtlib.models.common--summary">Summary</h4>
<h3 id="jwtlib.models.common--summary">Summary</h3>
<p>Common Pydantic mixins for authentication models.</p>
<p>This module provides reusable mixins for identity, password, and
account state. These mixes ensure consistency across internal
persistence models and public-facing projection models.</p>
@@ -1004,7 +1003,8 @@ persistence models and public-facing projection models.</p>
</td>
<td>
<div class="doc-md-description">
<p>Indicates whether the account is active and allowed to authenticate.</p>
<p>Indicates whether the account is active and allowed to
authenticate.</p>
</div>
</td>
</tr>

View File

@@ -923,51 +923,57 @@
<div class="doc doc-contents first">
<p>jwtlib Models: Structured Data for Authentication.</p>
<hr />
<h4 id="jwtlib.models--summary">Summary</h4>
<h3 id="jwtlib.models--summary">Summary</h3>
<p><code>jwtlib</code> Models: Structured Data for Authentication.</p>
<p>This package defines the core data models used by <code>jwtlib</code>. These models are
categorized into request payloads, response objects, persistence documents,
and security context.</p>
<hr />
<h4 id="jwtlib.models--model-categories">Model Categories</h4>
<p><strong>API Requests:</strong>
- <code>RegisterRequest</code>: Payload for creating new user accounts.
- <code>LoginRequest</code>: User credentials for issuing JWTs.
- <code>IntrospectRequest</code>: Internal payload for service-to-service token verification.</p>
<p><strong>API Responses:</strong>
- <code>PublicUser</code>: A safe, non-sensitive projection of a user profile.
- <code>LoginResponse</code>: Contains the issued access token and the PublicUser.
- <code>LogoutResponse</code>: Instruction for clients to clear stateless session state.</p>
<p><strong>Internal &amp; Security:</strong>
- <code>User</code>: The MongoDB-backed persistence model (Confined to repository layer).
- <code>TokenPayload</code>: Decoded claims from a validated JWT (sub, exp).
- <code>IntrospectResponse</code>: Structured result of a token validity check.</p>
<h3 id="jwtlib.models--model-categories">Model Categories</h3>
<p><strong>API Requests:</strong></p>
<ul>
<li><code>RegisterRequest</code>: Payload for creating new user accounts.</li>
<li><code>LoginRequest</code>: User credentials for issuing <code>JWT</code>s.</li>
<li><code>IntrospectRequest</code>: Internal payload for service-to-service token
verification.</li>
</ul>
<p><strong>API Responses:</strong></p>
<ul>
<li><code>PublicUser</code>: A safe, non-sensitive projection of a user profile.</li>
<li><code>LoginResponse</code>: Contains the issued access token and the <code>PublicUser</code>.</li>
<li><code>LogoutResponse</code>: Instruction for clients to clear stateless session state.</li>
</ul>
<p><strong>Internal &amp; Security:</strong></p>
<ul>
<li><code>User</code>: The MongoDB-backed persistence model (Confined to repository layer).</li>
<li><code>TokenPayload</code>: Decoded claims from a validated <code>JWT</code> (<code>sub</code>, <code>exp</code>).</li>
<li><code>IntrospectResponse</code>: Structured result of a token validity check.</li>
</ul>
<hr />
<h4 id="jwtlib.models--usage">Usage</h4>
<h3 id="jwtlib.models--usage">Usage</h3>
<p><strong>Validating an Auth Request:</strong></p>
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span>
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><code>from jwtlib.models import LoginRequest
auth_data = LoginRequest(username=&quot;tester&quot;, password=&quot;secure_password&quot;)
</code></pre></div></td></tr></table></div>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-1">1</a></span>
<span class="normal"><a href="#__codelineno-0-2">2</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-1"><a id="__codelineno-0-1" name="__codelineno-0-1"></a><span class="kn">from</span><span class="w"> </span><span class="nn">jwtlib.models</span><span class="w"> </span><span class="kn">import</span> <span class="n">LoginRequest</span>
</span><span id="__span-0-2"><a id="__codelineno-0-2" name="__codelineno-0-2"></a><span class="n">auth_data</span> <span class="o">=</span> <span class="n">LoginRequest</span><span class="p">(</span><span class="n">username</span><span class="o">=</span><span class="s2">&quot;tester&quot;</span><span class="p">,</span> <span class="n">password</span><span class="o">=</span><span class="s2">&quot;secure_password&quot;</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
<p><strong>Projecting a User to Public View:</strong></p>
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span>
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><code>from jwtlib.models import User, PublicUser
user_profile = PublicUser.model_validate(db_user, from_attributes=True)
</code></pre></div></td></tr></table></div>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-1-1">1</a></span>
<span class="normal"><a href="#__codelineno-1-2">2</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-1-1"><a id="__codelineno-1-1" name="__codelineno-1-1"></a><span class="kn">from</span><span class="w"> </span><span class="nn">jwtlib.models</span><span class="w"> </span><span class="kn">import</span> <span class="n">User</span><span class="p">,</span> <span class="n">PublicUser</span>
</span><span id="__span-1-2"><a id="__codelineno-1-2" name="__codelineno-1-2"></a><span class="n">user_profile</span> <span class="o">=</span> <span class="n">PublicUser</span><span class="o">.</span><span class="n">model_validate</span><span class="p">(</span><span class="n">db_user</span><span class="p">,</span> <span class="n">from_attributes</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
<hr />
<h4 id="jwtlib.models--public-api">Public API</h4>
<h3 id="jwtlib.models--public-api">Public API</h3>
<p>This package re-exports all <strong>validated data models</strong> required by the
authentication system. Consumers should import from this namespace
to ensure type safety and consistency.</p>
<ul>
<li>LoginRequest / LoginResponse</li>
<li>RegisterRequest</li>
<li>LogoutResponse</li>
<li>PublicUser</li>
<li>IntrospectRequest / IntrospectResponse</li>
<li>User (Persistence)</li>
<li>TokenPayload (JWT)</li>
<li><code>LoginRequest</code> / <code>LoginResponse</code></li>
<li><code>RegisterRequest</code></li>
<li><code>LogoutResponse</code></li>
<li><code>PublicUser</code></li>
<li><code>IntrospectRequest</code> / <code>IntrospectResponse</code></li>
<li><code>User</code> (Persistence)</li>
<li><code>TokenPayload</code> (<code>JWT</code>)</li>
</ul>
<hr />
@@ -1018,7 +1024,7 @@ to ensure type safety and consistency.</p>
</td>
<td>
<div class="doc-md-description">
<p>JWT access token to introspect.</p>
<p><code>JWT</code> access token to introspect.</p>
</div>
</td>
</tr>
@@ -1137,7 +1143,7 @@ to ensure type safety and consistency.</p>
Bases: <code><a class="autorefs autorefs-internal" title="jwtlib.models.common.IdentityMixin" href="common/#jwtlib.models.common.IdentityMixin">IdentityMixin</a></code>, <code><a class="autorefs autorefs-internal" title="jwtlib.models.common.PasswordMixin" href="common/#jwtlib.models.common.PasswordMixin">PasswordMixin</a></code></p>
<p>Payload for authenticating a user and issuing a JWT.</p>
<p>Payload for authenticating a user and issuing a <code>JWT</code>.</p>
<p><span class="doc-section-title">Attributes:</span></p>
@@ -1232,7 +1238,7 @@ to ensure type safety and consistency.</p>
</td>
<td>
<div class="doc-md-description">
<p>JWT access token for authenticated requests.</p>
<p><code>JWT</code> access token for authenticated requests.</p>
</div>
</td>
</tr>
@@ -1523,7 +1529,7 @@ to ensure type safety and consistency.</p>
Bases: <code><span title="pydantic.BaseModel">BaseModel</span></code></p>
<p>Decoded JWT payload.</p>
<p>Decoded <code>JWT</code> payload.</p>
<p><span class="doc-section-title">Attributes:</span></p>
@@ -1565,10 +1571,18 @@ to ensure type safety and consistency.</p>
<details class="notes" open>
<summary>Notes</summary>
<p><strong>Responsibilities:</strong></p>
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><code>- Represents the validated claims extracted from a JWT after signature verification. This model is used internally to enforce required claims and provide a typed interface to token data.
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span></pre></div></td><td class="code"><div><pre><span></span><code>- Represents the validated claims extracted from a `JWT` after
signature verification. This model is used internally to enforce
required claims and provide a typed interface to token data.
</code></pre></div></td></tr></table></div>
<p><strong>Guarantees:</strong></p>
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><code>- This model assumes the JWT signature has already been verified. No authorization decisions should be made solely on this model. Additional claims may exist but are intentionally ignored.
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span></pre></div></td><td class="code"><div><pre><span></span><code>- This model assumes the `JWT` signature has already been verified.
No authorization decisions should be made solely on this model.
Additional claims may exist but are intentionally ignored.
</code></pre></div></td></tr></table></div>
</details>
@@ -1639,10 +1653,18 @@ to ensure type safety and consistency.</p>
<details class="notes" open>
<summary>Notes</summary>
<p><strong>Responsibilities:</strong></p>
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><code>- Represents a user record as stored in the database. Includes sensitive fields and is strictly confined to the persistence layer.
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span></pre></div></td><td class="code"><div><pre><span></span><code>- Represents a user record as stored in the database. Includes
sensitive fields and is strictly confined to the persistence
layer.
</code></pre></div></td></tr></table></div>
<p><strong>Guarantees:</strong></p>
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><code>- This model MUST NOT be returned from authentication APIs. Consumers should use `PublicUser` instead. Password verification is handled by the repository layer.
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span></pre></div></td><td class="code"><div><pre><span></span><code>- This model MUST NOT be returned from authentication APIs.
Consumers should use `PublicUser` instead. Password verification
is handled by the repository layer.
</code></pre></div></td></tr></table></div>
</details>

View File

@@ -914,9 +914,8 @@
<div class="doc doc-contents first">
<p>Persistence-layer user model for MongoDB.</p>
<hr />
<h4 id="jwtlib.models.mongo--summary">Summary</h4>
<h3 id="jwtlib.models.mongo--summary">Summary</h3>
<p>Persistence-layer user model for MongoDB.</p>
<p>This module defines the internal database representation of a user.
It is used exclusively by the repository and persistence layers and
must never be exposed directly to consumers.</p>
@@ -980,10 +979,18 @@ must never be exposed directly to consumers.</p>
<details class="notes" open>
<summary>Notes</summary>
<p><strong>Responsibilities:</strong></p>
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><code>- Represents a user record as stored in the database. Includes sensitive fields and is strictly confined to the persistence layer.
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span></pre></div></td><td class="code"><div><pre><span></span><code>- Represents a user record as stored in the database. Includes
sensitive fields and is strictly confined to the persistence
layer.
</code></pre></div></td></tr></table></div>
<p><strong>Guarantees:</strong></p>
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><code>- This model MUST NOT be returned from authentication APIs. Consumers should use `PublicUser` instead. Password verification is handled by the repository layer.
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span></pre></div></td><td class="code"><div><pre><span></span><code>- This model MUST NOT be returned from authentication APIs.
Consumers should use `PublicUser` instead. Password verification
is handled by the repository layer.
</code></pre></div></td></tr></table></div>
</details>

View File

@@ -914,10 +914,9 @@
<div class="doc doc-contents first">
<p>JWT token payload models.</p>
<hr />
<h4 id="jwtlib.models.security--summary">Summary</h4>
<p>This module defines typed representations of decoded JWT payloads used
<h3 id="jwtlib.models.security--summary">Summary</h3>
<p>JWT token payload models.</p>
<p>This module defines typed representations of decoded <code>JWT</code> payloads used
internally for token validation and user resolution.</p>
@@ -947,7 +946,7 @@ internally for token validation and user resolution.</p>
Bases: <code><span title="pydantic.BaseModel">BaseModel</span></code></p>
<p>Decoded JWT payload.</p>
<p>Decoded <code>JWT</code> payload.</p>
<p><span class="doc-section-title">Attributes:</span></p>
@@ -989,10 +988,18 @@ internally for token validation and user resolution.</p>
<details class="notes" open>
<summary>Notes</summary>
<p><strong>Responsibilities:</strong></p>
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><code>- Represents the validated claims extracted from a JWT after signature verification. This model is used internally to enforce required claims and provide a typed interface to token data.
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span></pre></div></td><td class="code"><div><pre><span></span><code>- Represents the validated claims extracted from a `JWT` after
signature verification. This model is used internally to enforce
required claims and provide a typed interface to token data.
</code></pre></div></td></tr></table></div>
<p><strong>Guarantees:</strong></p>
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><code>- This model assumes the JWT signature has already been verified. No authorization decisions should be made solely on this model. Additional claims may exist but are intentionally ignored.
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span></pre></div></td><td class="code"><div><pre><span></span><code>- This model assumes the `JWT` signature has already been verified.
No authorization decisions should be made solely on this model.
Additional claims may exist but are intentionally ignored.
</code></pre></div></td></tr></table></div>
</details>