Provides JWT token management with:
- Secure token storage (localStorage/sessionStorage/memory)
- Automatic token refresh
- Request header injection
- Token validation and expiry checking
- Login/logout state management
- PAN bus integration for auth events

Class: PanJWT

Extends: HTMLElement
Provides JWT token management with:
- Secure token storage (localStorage/sessionStorage/memory)
- Automatic token refresh
- Request header injection
- Token validation and expiry checking
- Login/logout state management
- PAN bus integration for auth events

Attributes

Attribute Type Description
storage string Storage type: "localStorage", "sessionStorage", or "memory" (default: "localStorage")
auto-refresh boolean Enable automatic token refresh (default: true)
refresh-before number Seconds before expiry to refresh (default: 300)
token-key string Storage key for token (default: "jwt_token")
refresh-key string Storage key for refresh token (default: "jwt_refresh")
api-url string Base API URL for authentication endpoints
login-endpoint string Login endpoint path (default: "/auth/login")
refresh-endpoint string Refresh endpoint path (default: "/auth/refresh")
logout-endpoint string Logout endpoint path (default: "/auth/logout")

Events

Examples

<pan-jwt
  storage="localStorage"
  auto-refresh="true"
  refresh-before="300"
  token-key="auth_token">
</pan-jwt>
/
import { PanClient } from './pan-client.mjs';
/**
PAN JWT Authentication Component
Handles JWT token lifecycle and authentication state