analyze static method
Analyze the headers and URL of a given API endpoint.
Implementation
static Future<ApiSecurityResult> analyze(String url, {Map<String, String>? headers}) async {
final uri = Uri.parse(url);
final isHttps = uri.scheme == 'https';
headers ??= {};
final authHeader = headers['Authorization'] ?? '';
final hasAuthHeader = headers.containsKey('Authorization');
final hasJwtToken = authHeader.startsWith('Bearer ') && _isLikelyJwt(authHeader);
return ApiSecurityResult(
url: url,
isHttps: isHttps,
hasAuthHeader: hasAuthHeader,
hasJwtToken: hasJwtToken,
);
}