mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 02:39:19 +08:00
refactor: remove unused digest authentication model import and clean up JWT handling comments
This commit is contained in:
@@ -3,7 +3,6 @@ import 'dart:math' as math;
|
||||
|
||||
import 'package:convert/convert.dart';
|
||||
import 'package:crypto/crypto.dart' as crypto;
|
||||
import '../../models/auth/auth_digest_model.dart';
|
||||
import '../../models/models.dart';
|
||||
|
||||
Map<String, String>? splitAuthenticateHeader(String header) {
|
||||
@@ -221,17 +220,4 @@ class DigestAuth {
|
||||
final authString = 'Digest $authValuesString';
|
||||
return authString;
|
||||
}
|
||||
|
||||
// TODO: Use this function
|
||||
void initFromAuthenticateHeader(String /*!*/ authInfo) {
|
||||
final values = splitAuthenticateHeader(authInfo);
|
||||
if (values != null) {
|
||||
_algorithm = values['algorithm'] ?? _algorithm;
|
||||
_qop = values['qop'] ?? _qop;
|
||||
_realm = values['realm'] ?? _realm;
|
||||
_nonce = values['nonce'] ?? _nonce;
|
||||
_opaque = values['opaque'] ?? _opaque;
|
||||
_nc = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,12 +53,9 @@ Future<HttpRequestModel> handleAuth(
|
||||
case APIAuthType.jwt:
|
||||
if (authData.jwt != null) {
|
||||
final jwtAuth = authData.jwt!;
|
||||
|
||||
// Generate JWT token
|
||||
final jwtToken = generateJWT(jwtAuth);
|
||||
|
||||
if (jwtAuth.addTokenTo == 'header') {
|
||||
// Add to request header with prefix
|
||||
final headerValue = jwtAuth.headerPrefix.isNotEmpty
|
||||
? '${jwtAuth.headerPrefix} $jwtToken'
|
||||
: jwtToken;
|
||||
@@ -67,7 +64,6 @@ Future<HttpRequestModel> handleAuth(
|
||||
);
|
||||
updatedHeaderEnabledList.add(true);
|
||||
} else if (jwtAuth.addTokenTo == 'query') {
|
||||
// Add to query parameters(if selected)
|
||||
final paramKey = jwtAuth.queryParamKey.isNotEmpty
|
||||
? jwtAuth.queryParamKey
|
||||
: 'token';
|
||||
|
||||
Reference in New Issue
Block a user