configureJWTAuth method

void configureJWTAuth({
  1. required String jwtSecret,
  2. List<String> excludePaths = const ['/api/auth', '/api/public', '/health'],
})

Configura JWT authentication middleware Debe llamarse antes de start() para habilitar validación JWT

Implementation

void configureJWTAuth({
  required String jwtSecret,
  List<String> excludePaths = const ['/api/auth', '/api/public', '/health'],
}) {
  if (jwtSecret.isEmpty) {
    throw ArgumentError('JWT secret cannot be empty');
  }

  _jwtSecret = jwtSecret;
  _jwtExcludePaths = excludePaths;
  _jwtEnabled = true;

  // Rebuild pipeline with JWT enabled
  pipeline = _buildSecurePipeline(middleware);

  Log.i('🔐 JWT authentication middleware configured');
  Log.i('   Secret: ${jwtSecret.substring(0, 8)}...');
  Log.i('   Excluded paths: ${excludePaths.join(', ')}');
}