Hello. Right now, I am creating an API for an application. It is not a multiuser system, and doesn't need any profiles. I am planning on, in the future, working on projects that will be multi-user though. I have heard of the authentication frameworks through some neat videos, including the use of bearers with JWT, session cookies OAuth, OIDC, etc. How to organize these assets into code, however, is turning out to be quite confusing to me. I hear mentions of an "authentication/authroization server", but I am struggling to find explicit examples. This is my current impression of how it works, with FastAPI:
from typing import Annotation
from fastapi import FastAPI
from pydantic import BaseClass
app = FastAPI()
class Headers(BaseClass):
user_name: str
password: str
access_token: str | None = None
refresh_token: str | None = None
session_cookies: str | None = None
@app.get('/resource/')
async def get_resource(
headers: Annotation[Headers, Header()]
):
#1. Call to the authentication server OR a stored program
#2. Call to the authorization server OR a stored function
#3. Call code to handle the body of the data
pass