@cadriciel/module-auth
v0.3.2
Published
Authentication module for Cadriciel
Readme
🔐 @cadriciel/module-auth
Enterprise-grade authentication and identity management for the Cadriciel framework, featuring Keycloak integration and JWT security.
Features
- Keycloak Integration: Seamless OIDC/OAuth2 authentication.
- JWT Protection: Secure, stateless session management.
- Auto-Middleware: Injects the authenticated user object into the Hono context (
c.get('user')). - Secure Route Metadata: Activate authentication on any route by simply adding
secure: trueto its metadata. - REST Endpoints: Built-in
/api/userand/api/avatarroutes.
Usage
import AuthModule from "@cadriciel/module-auth";
kernel.load(AuthModule);Securing a Route
export const GET = (c: Context) => {
const user = c.get("user");
return c.json({ message: "Welcome", user });
};
GET.meta = {
secure: true // This activates the auth middleware for this route
};