mirror of
https://github.com/foss42/apidash.git
synced 2025-12-01 02:07:00 +08:00
feat: add oauth2 credential file handling
This commit is contained in:
@@ -9,35 +9,21 @@ part 'auth_oauth2_model.freezed.dart';
|
||||
class AuthOAuth2Model with _$AuthOAuth2Model {
|
||||
const factory AuthOAuth2Model({
|
||||
@Default(OAuth2GrantType.authorizationCode) OAuth2GrantType grantType,
|
||||
|
||||
required String authorizationUrl,
|
||||
|
||||
required String accessTokenUrl,
|
||||
|
||||
required String clientId,
|
||||
|
||||
required String clientSecret,
|
||||
|
||||
required String credentialsFilePath,
|
||||
String? redirectUrl,
|
||||
|
||||
String? scope,
|
||||
|
||||
String? state,
|
||||
|
||||
@Default("sha-256") String codeChallengeMethod,
|
||||
|
||||
String? codeVerifier,
|
||||
|
||||
String? codeChallenge,
|
||||
|
||||
String? username,
|
||||
|
||||
String? password,
|
||||
|
||||
String? refreshToken,
|
||||
|
||||
String? identityToken,
|
||||
|
||||
String? accessToken,
|
||||
}) = _AuthOAuth2Model;
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ mixin _$AuthOAuth2Model {
|
||||
String get accessTokenUrl => throw _privateConstructorUsedError;
|
||||
String get clientId => throw _privateConstructorUsedError;
|
||||
String get clientSecret => throw _privateConstructorUsedError;
|
||||
String get credentialsFilePath => throw _privateConstructorUsedError;
|
||||
String? get redirectUrl => throw _privateConstructorUsedError;
|
||||
String? get scope => throw _privateConstructorUsedError;
|
||||
String? get state => throw _privateConstructorUsedError;
|
||||
@@ -61,6 +62,7 @@ abstract class $AuthOAuth2ModelCopyWith<$Res> {
|
||||
String accessTokenUrl,
|
||||
String clientId,
|
||||
String clientSecret,
|
||||
String credentialsFilePath,
|
||||
String? redirectUrl,
|
||||
String? scope,
|
||||
String? state,
|
||||
@@ -95,6 +97,7 @@ class _$AuthOAuth2ModelCopyWithImpl<$Res, $Val extends AuthOAuth2Model>
|
||||
Object? accessTokenUrl = null,
|
||||
Object? clientId = null,
|
||||
Object? clientSecret = null,
|
||||
Object? credentialsFilePath = null,
|
||||
Object? redirectUrl = freezed,
|
||||
Object? scope = freezed,
|
||||
Object? state = freezed,
|
||||
@@ -129,6 +132,10 @@ class _$AuthOAuth2ModelCopyWithImpl<$Res, $Val extends AuthOAuth2Model>
|
||||
? _value.clientSecret
|
||||
: clientSecret // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
credentialsFilePath: null == credentialsFilePath
|
||||
? _value.credentialsFilePath
|
||||
: credentialsFilePath // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
redirectUrl: freezed == redirectUrl
|
||||
? _value.redirectUrl
|
||||
: redirectUrl // ignore: cast_nullable_to_non_nullable
|
||||
@@ -194,6 +201,7 @@ abstract class _$$AuthOAuth2ModelImplCopyWith<$Res>
|
||||
String accessTokenUrl,
|
||||
String clientId,
|
||||
String clientSecret,
|
||||
String credentialsFilePath,
|
||||
String? redirectUrl,
|
||||
String? scope,
|
||||
String? state,
|
||||
@@ -227,6 +235,7 @@ class __$$AuthOAuth2ModelImplCopyWithImpl<$Res>
|
||||
Object? accessTokenUrl = null,
|
||||
Object? clientId = null,
|
||||
Object? clientSecret = null,
|
||||
Object? credentialsFilePath = null,
|
||||
Object? redirectUrl = freezed,
|
||||
Object? scope = freezed,
|
||||
Object? state = freezed,
|
||||
@@ -261,6 +270,10 @@ class __$$AuthOAuth2ModelImplCopyWithImpl<$Res>
|
||||
? _value.clientSecret
|
||||
: clientSecret // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
credentialsFilePath: null == credentialsFilePath
|
||||
? _value.credentialsFilePath
|
||||
: credentialsFilePath // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
redirectUrl: freezed == redirectUrl
|
||||
? _value.redirectUrl
|
||||
: redirectUrl // ignore: cast_nullable_to_non_nullable
|
||||
@@ -319,6 +332,7 @@ class _$AuthOAuth2ModelImpl implements _AuthOAuth2Model {
|
||||
required this.accessTokenUrl,
|
||||
required this.clientId,
|
||||
required this.clientSecret,
|
||||
required this.credentialsFilePath,
|
||||
this.redirectUrl,
|
||||
this.scope,
|
||||
this.state,
|
||||
@@ -347,6 +361,8 @@ class _$AuthOAuth2ModelImpl implements _AuthOAuth2Model {
|
||||
@override
|
||||
final String clientSecret;
|
||||
@override
|
||||
final String credentialsFilePath;
|
||||
@override
|
||||
final String? redirectUrl;
|
||||
@override
|
||||
final String? scope;
|
||||
@@ -372,7 +388,7 @@ class _$AuthOAuth2ModelImpl implements _AuthOAuth2Model {
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AuthOAuth2Model(grantType: $grantType, authorizationUrl: $authorizationUrl, accessTokenUrl: $accessTokenUrl, clientId: $clientId, clientSecret: $clientSecret, redirectUrl: $redirectUrl, scope: $scope, state: $state, codeChallengeMethod: $codeChallengeMethod, codeVerifier: $codeVerifier, codeChallenge: $codeChallenge, username: $username, password: $password, refreshToken: $refreshToken, identityToken: $identityToken, accessToken: $accessToken)';
|
||||
return 'AuthOAuth2Model(grantType: $grantType, authorizationUrl: $authorizationUrl, accessTokenUrl: $accessTokenUrl, clientId: $clientId, clientSecret: $clientSecret, credentialsFilePath: $credentialsFilePath, redirectUrl: $redirectUrl, scope: $scope, state: $state, codeChallengeMethod: $codeChallengeMethod, codeVerifier: $codeVerifier, codeChallenge: $codeChallenge, username: $username, password: $password, refreshToken: $refreshToken, identityToken: $identityToken, accessToken: $accessToken)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -390,6 +406,8 @@ class _$AuthOAuth2ModelImpl implements _AuthOAuth2Model {
|
||||
other.clientId == clientId) &&
|
||||
(identical(other.clientSecret, clientSecret) ||
|
||||
other.clientSecret == clientSecret) &&
|
||||
(identical(other.credentialsFilePath, credentialsFilePath) ||
|
||||
other.credentialsFilePath == credentialsFilePath) &&
|
||||
(identical(other.redirectUrl, redirectUrl) ||
|
||||
other.redirectUrl == redirectUrl) &&
|
||||
(identical(other.scope, scope) || other.scope == scope) &&
|
||||
@@ -421,6 +439,7 @@ class _$AuthOAuth2ModelImpl implements _AuthOAuth2Model {
|
||||
accessTokenUrl,
|
||||
clientId,
|
||||
clientSecret,
|
||||
credentialsFilePath,
|
||||
redirectUrl,
|
||||
scope,
|
||||
state,
|
||||
@@ -458,6 +477,7 @@ abstract class _AuthOAuth2Model implements AuthOAuth2Model {
|
||||
required final String accessTokenUrl,
|
||||
required final String clientId,
|
||||
required final String clientSecret,
|
||||
required final String credentialsFilePath,
|
||||
final String? redirectUrl,
|
||||
final String? scope,
|
||||
final String? state,
|
||||
@@ -485,6 +505,8 @@ abstract class _AuthOAuth2Model implements AuthOAuth2Model {
|
||||
@override
|
||||
String get clientSecret;
|
||||
@override
|
||||
String get credentialsFilePath;
|
||||
@override
|
||||
String? get redirectUrl;
|
||||
@override
|
||||
String? get scope;
|
||||
|
||||
@@ -16,6 +16,7 @@ _$AuthOAuth2ModelImpl _$$AuthOAuth2ModelImplFromJson(
|
||||
accessTokenUrl: json['accessTokenUrl'] as String,
|
||||
clientId: json['clientId'] as String,
|
||||
clientSecret: json['clientSecret'] as String,
|
||||
credentialsFilePath: json['credentialsFilePath'] as String,
|
||||
redirectUrl: json['redirectUrl'] as String?,
|
||||
scope: json['scope'] as String?,
|
||||
state: json['state'] as String?,
|
||||
@@ -37,6 +38,7 @@ Map<String, dynamic> _$$AuthOAuth2ModelImplToJson(
|
||||
'accessTokenUrl': instance.accessTokenUrl,
|
||||
'clientId': instance.clientId,
|
||||
'clientSecret': instance.clientSecret,
|
||||
'credentialsFilePath': instance.credentialsFilePath,
|
||||
'redirectUrl': instance.redirectUrl,
|
||||
'scope': instance.scope,
|
||||
'state': instance.state,
|
||||
|
||||
Reference in New Issue
Block a user