kiss_authentication library
Kiss Auth Authentication Module
Provides JWT token validation and identity extraction interfaces. This module handles the "is this token valid?" part of authentication.
For credential-based authentication (the "how do I get a token?" part), use the kiss_login module.
For authorization checks (the "what can this user do?" part), use the kiss_authorization module.
Usage
import 'package:kiss_auth/kiss_authentication.dart';
// Create a JWT validator
final validator = JwtAuthValidator.hmac('your-secret-key');
// Validate a token
try {
final authData = await validator.validateToken(incomingToken);
print('User ID: ${authData.userId}');
print('Claims: ${authData.claims}');
} catch (e) {
print('Token validation failed: $e');
}
Classes
- AuthClaims
- Custom claim names used in this authentication library
- AuthenticationData
- Abstract representation of authentication data
- AuthValidator
- Abstract interface for token validation
- JwtAuthenticationData
- JWT-based implementation of authentication data
- JwtAuthValidator
- JWT token validator implementation
- JwtClaims
- Standard JWT claim names as defined in RFC 7519
- JwtClaimsData
- Structured representation of JWT claims with standard fields and extra claims
Enums
- JwtAlgorithm
- JWT algorithm types supported
Extensions
- AuthenticationDataJwtExtension on AuthenticationData
- Extensions for AuthenticationData to provide structured JWT claims access