mirror of
https://github.com/foss42/apidash.git
synced 2025-12-01 02:07:00 +08:00
fix: auth header generation
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:better_networking/consts.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'auth_oauth1_model.g.dart';
|
||||
@@ -12,7 +13,7 @@ class AuthOAuth1Model with _$AuthOAuth1Model {
|
||||
required String credentialsFilePath,
|
||||
String? accessToken,
|
||||
String? tokenSecret,
|
||||
@Default("hmacSha1") String signatureMethod,
|
||||
@Default(OAuth1SignatureMethod.hmacSha1) OAuth1SignatureMethod signatureMethod,
|
||||
@Default("header") String parameterLocation,
|
||||
@Default('1.0') String version,
|
||||
String? realm,
|
||||
|
||||
@@ -26,7 +26,8 @@ mixin _$AuthOAuth1Model {
|
||||
String get credentialsFilePath => throw _privateConstructorUsedError;
|
||||
String? get accessToken => throw _privateConstructorUsedError;
|
||||
String? get tokenSecret => throw _privateConstructorUsedError;
|
||||
String get signatureMethod => throw _privateConstructorUsedError;
|
||||
OAuth1SignatureMethod get signatureMethod =>
|
||||
throw _privateConstructorUsedError;
|
||||
String get parameterLocation => throw _privateConstructorUsedError;
|
||||
String get version => throw _privateConstructorUsedError;
|
||||
String? get realm => throw _privateConstructorUsedError;
|
||||
@@ -59,7 +60,7 @@ abstract class $AuthOAuth1ModelCopyWith<$Res> {
|
||||
String credentialsFilePath,
|
||||
String? accessToken,
|
||||
String? tokenSecret,
|
||||
String signatureMethod,
|
||||
OAuth1SignatureMethod signatureMethod,
|
||||
String parameterLocation,
|
||||
String version,
|
||||
String? realm,
|
||||
@@ -126,7 +127,7 @@ class _$AuthOAuth1ModelCopyWithImpl<$Res, $Val extends AuthOAuth1Model>
|
||||
signatureMethod: null == signatureMethod
|
||||
? _value.signatureMethod
|
||||
: signatureMethod // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
as OAuth1SignatureMethod,
|
||||
parameterLocation: null == parameterLocation
|
||||
? _value.parameterLocation
|
||||
: parameterLocation // ignore: cast_nullable_to_non_nullable
|
||||
@@ -180,7 +181,7 @@ abstract class _$$AuthOAuth1ModelImplCopyWith<$Res>
|
||||
String credentialsFilePath,
|
||||
String? accessToken,
|
||||
String? tokenSecret,
|
||||
String signatureMethod,
|
||||
OAuth1SignatureMethod signatureMethod,
|
||||
String parameterLocation,
|
||||
String version,
|
||||
String? realm,
|
||||
@@ -246,7 +247,7 @@ class __$$AuthOAuth1ModelImplCopyWithImpl<$Res>
|
||||
signatureMethod: null == signatureMethod
|
||||
? _value.signatureMethod
|
||||
: signatureMethod // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
as OAuth1SignatureMethod,
|
||||
parameterLocation: null == parameterLocation
|
||||
? _value.parameterLocation
|
||||
: parameterLocation // ignore: cast_nullable_to_non_nullable
|
||||
@@ -293,7 +294,7 @@ class _$AuthOAuth1ModelImpl implements _AuthOAuth1Model {
|
||||
required this.credentialsFilePath,
|
||||
this.accessToken,
|
||||
this.tokenSecret,
|
||||
this.signatureMethod = "hmacSha1",
|
||||
this.signatureMethod = OAuth1SignatureMethod.hmacSha1,
|
||||
this.parameterLocation = "header",
|
||||
this.version = '1.0',
|
||||
this.realm,
|
||||
@@ -319,7 +320,7 @@ class _$AuthOAuth1ModelImpl implements _AuthOAuth1Model {
|
||||
final String? tokenSecret;
|
||||
@override
|
||||
@JsonKey()
|
||||
final String signatureMethod;
|
||||
final OAuth1SignatureMethod signatureMethod;
|
||||
@override
|
||||
@JsonKey()
|
||||
final String parameterLocation;
|
||||
@@ -421,7 +422,7 @@ abstract class _AuthOAuth1Model implements AuthOAuth1Model {
|
||||
required final String credentialsFilePath,
|
||||
final String? accessToken,
|
||||
final String? tokenSecret,
|
||||
final String signatureMethod,
|
||||
final OAuth1SignatureMethod signatureMethod,
|
||||
final String parameterLocation,
|
||||
final String version,
|
||||
final String? realm,
|
||||
@@ -446,7 +447,7 @@ abstract class _AuthOAuth1Model implements AuthOAuth1Model {
|
||||
@override
|
||||
String? get tokenSecret;
|
||||
@override
|
||||
String get signatureMethod;
|
||||
OAuth1SignatureMethod get signatureMethod;
|
||||
@override
|
||||
String get parameterLocation;
|
||||
@override
|
||||
|
||||
@@ -14,7 +14,12 @@ _$AuthOAuth1ModelImpl _$$AuthOAuth1ModelImplFromJson(
|
||||
credentialsFilePath: json['credentialsFilePath'] as String,
|
||||
accessToken: json['accessToken'] as String?,
|
||||
tokenSecret: json['tokenSecret'] as String?,
|
||||
signatureMethod: json['signatureMethod'] as String? ?? "hmacSha1",
|
||||
signatureMethod:
|
||||
$enumDecodeNullable(
|
||||
_$OAuth1SignatureMethodEnumMap,
|
||||
json['signatureMethod'],
|
||||
) ??
|
||||
OAuth1SignatureMethod.hmacSha1,
|
||||
parameterLocation: json['parameterLocation'] as String? ?? "header",
|
||||
version: json['version'] as String? ?? '1.0',
|
||||
realm: json['realm'] as String?,
|
||||
@@ -33,7 +38,7 @@ Map<String, dynamic> _$$AuthOAuth1ModelImplToJson(
|
||||
'credentialsFilePath': instance.credentialsFilePath,
|
||||
'accessToken': instance.accessToken,
|
||||
'tokenSecret': instance.tokenSecret,
|
||||
'signatureMethod': instance.signatureMethod,
|
||||
'signatureMethod': _$OAuth1SignatureMethodEnumMap[instance.signatureMethod]!,
|
||||
'parameterLocation': instance.parameterLocation,
|
||||
'version': instance.version,
|
||||
'realm': instance.realm,
|
||||
@@ -43,3 +48,8 @@ Map<String, dynamic> _$$AuthOAuth1ModelImplToJson(
|
||||
'timestamp': instance.timestamp,
|
||||
'includeBodyHash': instance.includeBodyHash,
|
||||
};
|
||||
|
||||
const _$OAuth1SignatureMethodEnumMap = {
|
||||
OAuth1SignatureMethod.hmacSha1: 'hmacSha1',
|
||||
OAuth1SignatureMethod.plaintext: 'plaintext',
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user