Picks up the rewritten auth-server wiki (platform anatomy theme) and the regenerated lib artifacts, including the new pep-typed marker bounce.
1 line
8.6 KiB
JSON
1 line
8.6 KiB
JSON
{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"jwt","text":""},{"location":"#modules","title":"Modules","text":"<ul> <li>Jwt</li> </ul>"},{"location":"jwt/","title":"Jwt","text":"<ul> <li>App</li> </ul>"},{"location":"jwt/#jwt","title":"jwt","text":""},{"location":"jwt/#jwt--summary","title":"Summary","text":"<p>The <code>jwt</code> package is the HTTP surface of the Aetoskia Auth Service.</p> <p>It declares the FastAPI <code>router</code> that exposes the authentication endpoints (<code>/register</code>, <code>/login</code>, <code>/me</code>, <code>/logout</code>, <code>/introspect</code>) and the <code>get_current_user</code> bearer-token dependency used to protect routes.</p> <p>All user management, hashing, and token logic is delegated to the :mod:<code>jwtlib</code> package (see the <code>py-jwt</code> project), while MongoDB persistence comes from <code>mongo_ops</code>.</p>"},{"location":"jwt/#jwt--quick-start","title":"Quick start","text":"<p>Wire the router into an application:</p> <pre><code>from fastapi import FastAPI\nimport jwt\n\napp = FastAPI()\napp.include_router(jwt.router)\n</code></pre> <p>Protect a route with the current user:</p> <pre><code>from fastapi import Depends\nfrom jwtlib import PublicUser\nfrom jwt import get_current_user\n\n@app.get(\"/profile\")\nasync def profile(current_user: PublicUser = Depends(get_current_user)):\n return current_user\n</code></pre>"},{"location":"jwt/#jwt--notes","title":"Notes","text":"<ul> <li>The router mounts with an empty prefix and the <code>Auth</code> tag.</li> <li><code>get_current_user</code> raises <code>401</code> with <code>WWW-Authenticate: Bearer</code> when the header is missing or the token cannot be validated.</li> </ul>"},{"location":"jwt/#jwt-functions","title":"Functions","text":""},{"location":"jwt/#jwt.get_current_user","title":"get_current_user <code>async</code>","text":"<pre><code>get_current_user(credentials: HTTPAuthorizationCredentials | None = Depends(bearer_scheme)) -> PublicUser\n</code></pre> <p>Resolve the authenticated user from the bearer credentials.</p> <p>Decodes the JWT via <code>get_logged_in_user</code> and returns the matching public user profile. Any decoding, validity, or lookup failure produces the same generic <code>401</code> response so that the endpoint does not leak token internals.</p> <p>Parameters:</p> Name Type Description Default <code>credentials</code> <code>HTTPAuthorizationCredentials | None</code> <p>Bearer credentials extracted from the <code>Authorization</code> header, or None when the header is absent.</p> <code>Depends(bearer_scheme)</code> <p>Returns:</p> Name Type Description <code>PublicUser</code> <code>PublicUser</code> <p>The public profile of the authenticated user.</p> <p>Raises:</p> Type Description <code>HTTPException</code> <p>With status <code>401</code> and header <code>WWW-Authenticate: Bearer</code> when the credentials are missing or the token is not valid.</p>"},{"location":"jwt/app/","title":"App","text":""},{"location":"jwt/app/#jwt.app","title":"jwt.app","text":""},{"location":"jwt/app/#jwt.app--summary","title":"Summary","text":"<p>HTTP routes for the Aetoskia Auth Service.</p> <p>This module assembles the authentication endpoint set: user registration, login (JWT issuance), current-user lookup, stateless logout, and the internal service-to-service token introspection endpoint. It also provides the <code>get_current_user</code> FastAPI dependency that decodes the bearer token and resolves the authenticated user.</p> <p>The module is a thin FastAPI layer over the <code>jwtlib</code> application logic; no password or token handling is implemented here.</p>"},{"location":"jwt/app/#jwt.app--notes","title":"Notes","text":"<ul> <li><code>/introspect</code> is tagged <code>Internal</code> and is consumed by other services via <code>jwtlib.introspection</code> or the <code>openapi-first</code> generated dependencies.</li> <li>Logout is stateless: no server-side token invalidation is performed.</li> </ul>"},{"location":"jwt/app/#jwt.app-functions","title":"Functions","text":""},{"location":"jwt/app/#jwt.app.create_user","title":"create_user <code>async</code>","text":"<pre><code>create_user(user: RegisterRequest = Body(...)) -> PublicUser\n</code></pre> <p>Register a new user account.</p> <p>The password is hashed server side and the returned profile never contains the password.</p> <p>Parameters:</p> Name Type Description Default <code>user</code> <code>RegisterRequest</code> <p>Registration payload containing <code>username</code>, optional <code>email</code>, and <code>password</code> (minimum 6 characters).</p> <code>Body(...)</code> <p>Returns:</p> Name Type Description <code>PublicUser</code> <code>PublicUser</code> <p>The created public user profile.</p>"},{"location":"jwt/app/#jwt.app.get_current_user","title":"get_current_user <code>async</code>","text":"<pre><code>get_current_user(credentials: HTTPAuthorizationCredentials | None = Depends(bearer_scheme)) -> PublicUser\n</code></pre> <p>Resolve the authenticated user from the bearer credentials.</p> <p>Decodes the JWT via <code>get_logged_in_user</code> and returns the matching public user profile. Any decoding, validity, or lookup failure produces the same generic <code>401</code> response so that the endpoint does not leak token internals.</p> <p>Parameters:</p> Name Type Description Default <code>credentials</code> <code>HTTPAuthorizationCredentials | None</code> <p>Bearer credentials extracted from the <code>Authorization</code> header, or None when the header is absent.</p> <code>Depends(bearer_scheme)</code> <p>Returns:</p> Name Type Description <code>PublicUser</code> <code>PublicUser</code> <p>The public profile of the authenticated user.</p> <p>Raises:</p> Type Description <code>HTTPException</code> <p>With status <code>401</code> and header <code>WWW-Authenticate: Bearer</code> when the credentials are missing or the token is not valid.</p>"},{"location":"jwt/app/#jwt.app.introspect","title":"introspect <code>async</code>","text":"<pre><code>introspect(body: IntrospectRequest = Body(...)) -> IntrospectResponse\n</code></pre> <p>Introspect a JWT for other microservices.</p> <p>Verifies the token and returns the user only when it is active and valid.</p> <p>Parameters:</p> Name Type Description Default <code>body</code> <code>IntrospectRequest</code> <p>Request containing the <code>token</code> to verify.</p> <code>Body(...)</code> <p>Returns:</p> Name Type Description <code>IntrospectResponse</code> <code>IntrospectResponse</code> <p>Always a <code>200</code> response with <code>active</code> and, when valid, the public user profile.</p>"},{"location":"jwt/app/#jwt.app.login","title":"login <code>async</code>","text":"<pre><code>login(user: LoginRequest = Body(...)) -> LoginResponse\n</code></pre> <p>Authenticate a user and issue a JWT access token.</p> <p>Parameters:</p> Name Type Description Default <code>user</code> <code>LoginRequest</code> <p>Login payload containing <code>username</code> and <code>password</code>.</p> <code>Body(...)</code> <p>Returns:</p> Name Type Description <code>LoginResponse</code> <code>LoginResponse</code> <p>The issued access token together with the public user profile.</p> <p>Raises:</p> Type Description <code>HTTPException</code> <p>With status <code>401</code> and detail <code>Invalid credentials</code> when the credentials do not match.</p>"},{"location":"jwt/app/#jwt.app.logout","title":"logout <code>async</code>","text":"<pre><code>logout(_: PublicUser = Depends(get_current_user)) -> LogoutResponse\n</code></pre> <p>Log out the current user (stateless).</p> <p>No server-side token invalidation is performed; the client must discard the access token.</p> <p>Parameters:</p> Name Type Description Default <code>_</code> <code>PublicUser</code> <p>The authenticated user (validates the bearer token).</p> <code>Depends(get_current_user)</code> <p>Returns:</p> Name Type Description <code>LogoutResponse</code> <code>LogoutResponse</code> <p>A message instructing the client to discard the token.</p>"},{"location":"jwt/app/#jwt.app.read_users_me","title":"read_users_me <code>async</code>","text":"<pre><code>read_users_me(current_user: PublicUser = Depends(get_current_user)) -> PublicUser\n</code></pre> <p>Return the currently authenticated user's public profile.</p> <p>Parameters:</p> Name Type Description Default <code>current_user</code> <code>PublicUser</code> <p>The authenticated user resolved by the bearer dependency.</p> <code>Depends(get_current_user)</code> <p>Returns:</p> Name Type Description <code>PublicUser</code> <code>PublicUser</code> <p>The public profile of the requesting user.</p>"}]} |