Authentication
Firmiana uses opaque database-backed bearer tokens for Matrix session management, not pure JWTs.
Token Types
Auth Flow
Registration (UIAA)
Registration uses the UIAA (User-Interactive Authentication API) framework. The server declares available authentication flows, and the client completes each stage.
Supported stages:
m.login.password— Username/password authenticationm.login.dummy— No-op stage (for registration without password)
Login
Login creates a new device entry and issues an access token + refresh token pair.
Token Refresh
Logout
Token Validation
Every authenticated request goes through:
MatrixAccessTokenValidator.validateToken()— ExtractsBearer <token>from Authorization headerMatrixTokenService.validateAccessToken()— Looks up token inuser_access_tokenstable- Token metadata loaded into
Authenticationattributes:user_id— Matrix user IDdevice_id— Device identifieraccess_token_id— Database record IDis_guest— Guest flagis_admin— Admin flag
Password Storage
Passwords are hashed using PBKDF2 with SHA-256. The system supports automatic upgrade of legacy hash formats when a user successfully logs in.
Configuration
The jwt.enabled: true setting in application.yml is a red herring for Matrix authentication. Matrix session tokens are opaque database-backed tokens, not JWTs. The JWT configuration exists for Micronaut Security integration but is not the source of session validation.