chore: remove email sign-in, use server-side sessions
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
b1fe836ed0
commit
86b742f510
8 changed files with 9 additions and 907 deletions
|
|
@ -10,7 +10,6 @@
|
||||||
// ignore_for_file: invalid_use_of_internal_member
|
// ignore_for_file: invalid_use_of_internal_member
|
||||||
|
|
||||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||||
import 'dart:async' as _ida;
|
|
||||||
import 'package:http/http.dart' as _i85jenna;
|
import 'package:http/http.dart' as _i85jenna;
|
||||||
import 'package:serverpod_auth_core_client/serverpod_auth_core_client.dart'
|
import 'package:serverpod_auth_core_client/serverpod_auth_core_client.dart'
|
||||||
as _iacc;
|
as _iacc;
|
||||||
|
|
@ -19,231 +18,6 @@ import 'package:serverpod_auth_idp_client/serverpod_auth_idp_client.dart'
|
||||||
import 'package:serverpod_client/serverpod_client.dart' as _isc;
|
import 'package:serverpod_client/serverpod_client.dart' as _isc;
|
||||||
import 'protocol.dart' as _il2as5qe;
|
import 'protocol.dart' as _il2as5qe;
|
||||||
|
|
||||||
/// By extending [EmailIdpBaseEndpoint], the email identity provider endpoints
|
|
||||||
/// are made available on the server and enable the corresponding sign-in widget
|
|
||||||
/// on the client.
|
|
||||||
/// {@category Endpoint}
|
|
||||||
class EndpointEmailIdp extends _iaic.EndpointEmailIdpBase {
|
|
||||||
EndpointEmailIdp(_isc.EndpointCaller caller) : super(caller);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get name => 'emailIdp';
|
|
||||||
|
|
||||||
/// Logs in the user and returns a new session.
|
|
||||||
///
|
|
||||||
/// Throws an [EmailAccountLoginException] in case of errors, with reason:
|
|
||||||
/// - [EmailAccountLoginExceptionReason.invalidCredentials] if the email or
|
|
||||||
/// password is incorrect.
|
|
||||||
/// - [EmailAccountLoginExceptionReason.tooManyAttempts] if there have been
|
|
||||||
/// too many failed login attempts.
|
|
||||||
///
|
|
||||||
/// Throws an [AuthUserBlockedException] if the auth user is blocked.
|
|
||||||
@override
|
|
||||||
_ida.Future<_iacc.AuthSuccess> login({
|
|
||||||
required String email,
|
|
||||||
required String password,
|
|
||||||
}) => caller.callServerEndpoint<_iacc.AuthSuccess>(
|
|
||||||
'emailIdp',
|
|
||||||
'login',
|
|
||||||
{
|
|
||||||
'email': email,
|
|
||||||
'password': password,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
/// Starts the registration for a new user account with an email-based login
|
|
||||||
/// associated to it.
|
|
||||||
///
|
|
||||||
/// Upon successful completion of this method, an email will have been
|
|
||||||
/// sent to [email] with a verification link, which the user must open to
|
|
||||||
/// complete the registration.
|
|
||||||
///
|
|
||||||
/// Always returns a account request ID, which can be used to complete the
|
|
||||||
/// registration. If the email is already registered, the returned ID will not
|
|
||||||
/// be valid.
|
|
||||||
@override
|
|
||||||
_ida.Future<_isc.UuidValue> startRegistration({required String email}) =>
|
|
||||||
caller.callServerEndpoint<_isc.UuidValue>(
|
|
||||||
'emailIdp',
|
|
||||||
'startRegistration',
|
|
||||||
{'email': email},
|
|
||||||
);
|
|
||||||
|
|
||||||
/// Verifies an account request code and returns a token
|
|
||||||
/// that can be used to complete the account creation.
|
|
||||||
///
|
|
||||||
/// Throws an [EmailAccountRequestException] in case of errors, with reason:
|
|
||||||
/// - [EmailAccountRequestExceptionReason.expired] if the account request has
|
|
||||||
/// already expired.
|
|
||||||
/// - [EmailAccountRequestExceptionReason.policyViolation] if the password
|
|
||||||
/// does not comply with the password policy.
|
|
||||||
/// - [EmailAccountRequestExceptionReason.invalid] if no request exists
|
|
||||||
/// for the given [accountRequestId] or [verificationCode] is invalid.
|
|
||||||
@override
|
|
||||||
_ida.Future<String> verifyRegistrationCode({
|
|
||||||
required _isc.UuidValue accountRequestId,
|
|
||||||
required String verificationCode,
|
|
||||||
}) => caller.callServerEndpoint<String>(
|
|
||||||
'emailIdp',
|
|
||||||
'verifyRegistrationCode',
|
|
||||||
{
|
|
||||||
'accountRequestId': accountRequestId,
|
|
||||||
'verificationCode': verificationCode,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
/// Completes a new account registration, creating a new auth user with a
|
|
||||||
/// profile and attaching the given email account to it.
|
|
||||||
///
|
|
||||||
/// Throws an [EmailAccountRequestException] in case of errors, with reason:
|
|
||||||
/// - [EmailAccountRequestExceptionReason.expired] if the account request has
|
|
||||||
/// already expired.
|
|
||||||
/// - [EmailAccountRequestExceptionReason.policyViolation] if the password
|
|
||||||
/// does not comply with the password policy.
|
|
||||||
/// - [EmailAccountRequestExceptionReason.invalid] if the [registrationToken]
|
|
||||||
/// is invalid.
|
|
||||||
///
|
|
||||||
/// Throws an [AuthUserBlockedException] if the auth user is blocked.
|
|
||||||
///
|
|
||||||
/// Returns a session for the newly created user.
|
|
||||||
@override
|
|
||||||
_ida.Future<_iacc.AuthSuccess> finishRegistration({
|
|
||||||
required String registrationToken,
|
|
||||||
required String password,
|
|
||||||
}) => caller.callServerEndpoint<_iacc.AuthSuccess>(
|
|
||||||
'emailIdp',
|
|
||||||
'finishRegistration',
|
|
||||||
{
|
|
||||||
'registrationToken': registrationToken,
|
|
||||||
'password': password,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
/// Requests a password reset for [email].
|
|
||||||
///
|
|
||||||
/// If the email address is registered, an email with reset instructions will
|
|
||||||
/// be send out. If the email is unknown, this method will have no effect.
|
|
||||||
///
|
|
||||||
/// Always returns a password reset request ID, which can be used to complete
|
|
||||||
/// the reset. If the email is not registered, the returned ID will not be
|
|
||||||
/// valid.
|
|
||||||
///
|
|
||||||
/// Throws an [EmailAccountPasswordResetException] in case of errors, with reason:
|
|
||||||
/// - [EmailAccountPasswordResetExceptionReason.tooManyAttempts] if the user has
|
|
||||||
/// made too many attempts trying to request a password reset.
|
|
||||||
///
|
|
||||||
@override
|
|
||||||
_ida.Future<_isc.UuidValue> startPasswordReset({required String email}) =>
|
|
||||||
caller.callServerEndpoint<_isc.UuidValue>(
|
|
||||||
'emailIdp',
|
|
||||||
'startPasswordReset',
|
|
||||||
{'email': email},
|
|
||||||
);
|
|
||||||
|
|
||||||
/// Verifies a password reset code and returns a finishPasswordResetToken
|
|
||||||
/// that can be used to finish the password reset.
|
|
||||||
///
|
|
||||||
/// Throws an [EmailAccountPasswordResetException] in case of errors, with reason:
|
|
||||||
/// - [EmailAccountPasswordResetExceptionReason.expired] if the password reset
|
|
||||||
/// request has already expired.
|
|
||||||
/// - [EmailAccountPasswordResetExceptionReason.tooManyAttempts] if the user has
|
|
||||||
/// made too many attempts trying to verify the password reset.
|
|
||||||
/// - [EmailAccountPasswordResetExceptionReason.invalid] if no request exists
|
|
||||||
/// for the given [passwordResetRequestId] or [verificationCode] is invalid.
|
|
||||||
///
|
|
||||||
/// If multiple steps are required to complete the password reset, this endpoint
|
|
||||||
/// should be overridden to return credentials for the next step instead
|
|
||||||
/// of the credentials for setting the password.
|
|
||||||
@override
|
|
||||||
_ida.Future<String> verifyPasswordResetCode({
|
|
||||||
required _isc.UuidValue passwordResetRequestId,
|
|
||||||
required String verificationCode,
|
|
||||||
}) => caller.callServerEndpoint<String>(
|
|
||||||
'emailIdp',
|
|
||||||
'verifyPasswordResetCode',
|
|
||||||
{
|
|
||||||
'passwordResetRequestId': passwordResetRequestId,
|
|
||||||
'verificationCode': verificationCode,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
/// Completes a password reset request by setting a new password.
|
|
||||||
///
|
|
||||||
/// The [verificationCode] returned from [verifyPasswordResetCode] is used to
|
|
||||||
/// validate the password reset request.
|
|
||||||
///
|
|
||||||
/// Throws an [EmailAccountPasswordResetException] in case of errors, with reason:
|
|
||||||
/// - [EmailAccountPasswordResetExceptionReason.expired] if the password reset
|
|
||||||
/// request has already expired.
|
|
||||||
/// - [EmailAccountPasswordResetExceptionReason.policyViolation] if the new
|
|
||||||
/// password does not comply with the password policy.
|
|
||||||
/// - [EmailAccountPasswordResetExceptionReason.invalid] if no request exists
|
|
||||||
/// for the given [passwordResetRequestId] or [verificationCode] is invalid.
|
|
||||||
///
|
|
||||||
/// Throws an [AuthUserBlockedException] if the auth user is blocked.
|
|
||||||
@override
|
|
||||||
_ida.Future<void> finishPasswordReset({
|
|
||||||
required String finishPasswordResetToken,
|
|
||||||
required String newPassword,
|
|
||||||
}) => caller.callServerEndpoint<void>(
|
|
||||||
'emailIdp',
|
|
||||||
'finishPasswordReset',
|
|
||||||
{
|
|
||||||
'finishPasswordResetToken': finishPasswordResetToken,
|
|
||||||
'newPassword': newPassword,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
@override
|
|
||||||
_ida.Future<bool> hasAccount() => caller.callServerEndpoint<bool>(
|
|
||||||
'emailIdp',
|
|
||||||
'hasAccount',
|
|
||||||
{},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// By extending [RefreshJwtTokensEndpoint], the JWT token refresh endpoint
|
|
||||||
/// is made available on the server and enables automatic token refresh on the client.
|
|
||||||
/// {@category Endpoint}
|
|
||||||
class EndpointJwtRefresh extends _iacc.EndpointRefreshJwtTokens {
|
|
||||||
EndpointJwtRefresh(_isc.EndpointCaller caller) : super(caller);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get name => 'jwtRefresh';
|
|
||||||
|
|
||||||
/// Creates a new token pair for the given [refreshToken].
|
|
||||||
///
|
|
||||||
/// If [refreshToken] is omitted, cookie-mode web clients fall back to the
|
|
||||||
/// configured HttpOnly refresh cookie. When neither source is present this
|
|
||||||
/// throws [RefreshTokenNotFoundException], the same public "no usable refresh
|
|
||||||
/// credential" exception used for unknown refresh tokens.
|
|
||||||
///
|
|
||||||
/// Can throw the following exceptions:
|
|
||||||
/// -[RefreshTokenMalformedException]: refresh token is malformed and could
|
|
||||||
/// not be parsed. Not expected to happen for tokens issued by the server.
|
|
||||||
/// -[RefreshTokenNotFoundException]: refresh token is unknown to the server.
|
|
||||||
/// Either the token was deleted or generated by a different server.
|
|
||||||
/// -[RefreshTokenExpiredException]: refresh token has expired. Will happen
|
|
||||||
/// only if it has not been used within configured `refreshTokenLifetime`.
|
|
||||||
/// -[RefreshTokenInvalidSecretException]: refresh token is incorrect, meaning
|
|
||||||
/// it does not refer to the current secret refresh token. This indicates
|
|
||||||
/// either a malfunctioning client or a malicious attempt by someone who has
|
|
||||||
/// obtained the refresh token. In this case the underlying refresh token
|
|
||||||
/// will be deleted, and access to it will expire fully when the last access
|
|
||||||
/// token is elapsed.
|
|
||||||
///
|
|
||||||
/// This endpoint is unauthenticated, meaning the client won't include any
|
|
||||||
/// authentication information with the call.
|
|
||||||
@override
|
|
||||||
_ida.Future<_iacc.AuthSuccess> refreshAccessToken({String? refreshToken}) =>
|
|
||||||
caller.callServerEndpoint<_iacc.AuthSuccess>(
|
|
||||||
'jwtRefresh',
|
|
||||||
'refreshAccessToken',
|
|
||||||
{'refreshToken': refreshToken},
|
|
||||||
authenticated: false,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Modules {
|
class Modules {
|
||||||
Modules(Client client) {
|
Modules(Client client) {
|
||||||
serverpod_auth_idp = _iaic.Caller(client);
|
serverpod_auth_idp = _iaic.Caller(client);
|
||||||
|
|
@ -282,22 +56,13 @@ class Client extends _isc.ServerpodClientShared {
|
||||||
disconnectStreamsOnLostInternetConnection,
|
disconnectStreamsOnLostInternetConnection,
|
||||||
httpClientOverride: httpClientOverride,
|
httpClientOverride: httpClientOverride,
|
||||||
) {
|
) {
|
||||||
emailIdp = EndpointEmailIdp(this);
|
|
||||||
jwtRefresh = EndpointJwtRefresh(this);
|
|
||||||
modules = Modules(this);
|
modules = Modules(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
late final EndpointEmailIdp emailIdp;
|
|
||||||
|
|
||||||
late final EndpointJwtRefresh jwtRefresh;
|
|
||||||
|
|
||||||
late final Modules modules;
|
late final Modules modules;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, _isc.EndpointRef> get endpointRefLookup => {
|
Map<String, _isc.EndpointRef> get endpointRefLookup => {};
|
||||||
'emailIdp': emailIdp,
|
|
||||||
'jwtRefresh': jwtRefresh,
|
|
||||||
};
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, _isc.ModuleEndpointCaller> get moduleLookup => {
|
Map<String, _isc.ModuleEndpointCaller> get moduleLookup => {
|
||||||
|
|
|
||||||
|
|
@ -1,78 +0,0 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:serverpod_auth_idp_flutter/serverpod_auth_idp_flutter.dart';
|
|
||||||
|
|
||||||
import '../client.dart';
|
|
||||||
|
|
||||||
class SignInScreen extends StatefulWidget {
|
|
||||||
final Widget child;
|
|
||||||
const SignInScreen({super.key, required this.child});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<SignInScreen> createState() => _SignInScreenState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _SignInScreenState extends State<SignInScreen> {
|
|
||||||
bool _isSignedIn = false;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
client.auth.authInfoListenable.addListener(_updateSignedInState);
|
|
||||||
_isSignedIn = client.auth.isAuthenticated;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
client.auth.authInfoListenable.removeListener(_updateSignedInState);
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
void _updateSignedInState() {
|
|
||||||
setState(() {
|
|
||||||
_isSignedIn = client.auth.isAuthenticated;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final colors = Theme.of(context).colorScheme;
|
|
||||||
|
|
||||||
return _isSignedIn
|
|
||||||
? widget.child
|
|
||||||
: Center(
|
|
||||||
child: SignInWidget(
|
|
||||||
client: client,
|
|
||||||
onAuthenticated: () {
|
|
||||||
context.showSnackBar(
|
|
||||||
message: 'User authenticated.',
|
|
||||||
backgroundColor: colors.primaryContainer,
|
|
||||||
foregroundColor: colors.onPrimaryContainer,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
onError: (error) {
|
|
||||||
context.showSnackBar(
|
|
||||||
message: 'Authentication failed: $error',
|
|
||||||
backgroundColor: colors.errorContainer,
|
|
||||||
foregroundColor: colors.onErrorContainer,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension on BuildContext {
|
|
||||||
void showSnackBar({
|
|
||||||
required String message,
|
|
||||||
required Color backgroundColor,
|
|
||||||
required Color foregroundColor,
|
|
||||||
}) {
|
|
||||||
ScaffoldMessenger.of(this).showSnackBar(
|
|
||||||
SnackBar(
|
|
||||||
content: Text(message, style: TextStyle(color: foregroundColor)),
|
|
||||||
backgroundColor: backgroundColor,
|
|
||||||
duration: const Duration(seconds: 5),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import 'package:serverpod_auth_idp_server/core.dart';
|
import 'package:serverpod_auth_idp_server/core.dart';
|
||||||
import 'package:serverpod_auth_idp_server/providers/email.dart';
|
|
||||||
import 'package:serverpod_cloud_storage/serverpod_cloud_storage.dart';
|
import 'package:serverpod_cloud_storage/serverpod_cloud_storage.dart';
|
||||||
|
|
||||||
import 'src/generated/serverpod.dart';
|
import 'src/generated/serverpod.dart';
|
||||||
|
|
@ -15,20 +14,14 @@ void run(List<String> args) async {
|
||||||
// and the identity providers will be the authentication options available for users.
|
// and the identity providers will be the authentication options available for users.
|
||||||
pod.initializeAuthServices(
|
pod.initializeAuthServices(
|
||||||
tokenManagerBuilders: [
|
tokenManagerBuilders: [
|
||||||
// Use JWT for authentication keys towards the server.
|
// Server-side sessions: revocable immediately, scopes live on the session row.
|
||||||
JwtConfigFromPasswords(),
|
// No absolute lifetime (anonymous session cannot be restored). The inactivity
|
||||||
],
|
// timeout matches the pruning policy for abandoned accounts.
|
||||||
identityProviderBuilders: [
|
ServerSideSessionsConfigFromPasswords(
|
||||||
// Configure the email identity provider for email/password authentication.
|
defaultSessionInactivityTimeout: const Duration(days: 90),
|
||||||
// The default setup works with Serverpod Cloud without configuration. In
|
|
||||||
// development the verification codes are logged to the console, and in
|
|
||||||
// staging and production they are sent through the Serverpod Cloud email
|
|
||||||
// service. If you want to use a custom provider for sending emails, use
|
|
||||||
// `EmailIdpConfigFromPasswords`.
|
|
||||||
ServerpodCloudEmailIdpConfig(
|
|
||||||
appDisplayName: 'halkyon_learn',
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
identityProviderBuilders: [],
|
||||||
);
|
);
|
||||||
|
|
||||||
// Configure cloud storage.
|
// Configure cloud storage.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
import 'package:serverpod_auth_idp_server/providers/email.dart';
|
|
||||||
|
|
||||||
/// By extending [EmailIdpBaseEndpoint], the email identity provider endpoints
|
|
||||||
/// are made available on the server and enable the corresponding sign-in widget
|
|
||||||
/// on the client.
|
|
||||||
class EmailIdpEndpoint extends EmailIdpBaseEndpoint {}
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
import 'package:serverpod_auth_idp_server/core.dart';
|
|
||||||
|
|
||||||
/// By extending [RefreshJwtTokensEndpoint], the JWT token refresh endpoint
|
|
||||||
/// is made available on the server and enables automatic token refresh on the client.
|
|
||||||
class JwtRefreshEndpoint extends RefreshJwtTokensEndpoint {}
|
|
||||||
|
|
@ -15,232 +15,10 @@ import 'package:serverpod_auth_core_server/serverpod_auth_core_server.dart'
|
||||||
as _iacs;
|
as _iacs;
|
||||||
import 'package:serverpod_auth_idp_server/serverpod_auth_idp_server.dart'
|
import 'package:serverpod_auth_idp_server/serverpod_auth_idp_server.dart'
|
||||||
as _iais;
|
as _iais;
|
||||||
import '../auth/email_idp_endpoint.dart' as _iuc1hd5t;
|
|
||||||
import '../auth/jwt_refresh_endpoint.dart' as _inwq3ztq;
|
|
||||||
|
|
||||||
class Endpoints extends _is.EndpointDispatch {
|
class Endpoints extends _is.EndpointDispatch {
|
||||||
@override
|
@override
|
||||||
void initializeEndpoints(_is.Server server) {
|
void initializeEndpoints(_is.Server server) {
|
||||||
var endpoints = <String, _is.Endpoint>{
|
|
||||||
'emailIdp': _iuc1hd5t.EmailIdpEndpoint()
|
|
||||||
..initialize(
|
|
||||||
server,
|
|
||||||
'emailIdp',
|
|
||||||
null,
|
|
||||||
),
|
|
||||||
'jwtRefresh': _inwq3ztq.JwtRefreshEndpoint()
|
|
||||||
..initialize(
|
|
||||||
server,
|
|
||||||
'jwtRefresh',
|
|
||||||
null,
|
|
||||||
),
|
|
||||||
};
|
|
||||||
connectors['emailIdp'] = _is.EndpointConnector(
|
|
||||||
name: 'emailIdp',
|
|
||||||
endpoint: endpoints['emailIdp']!,
|
|
||||||
methodConnectors: {
|
|
||||||
'login': _is.MethodConnector(
|
|
||||||
name: 'login',
|
|
||||||
params: {
|
|
||||||
'email': _is.ParameterDescription(
|
|
||||||
name: 'email',
|
|
||||||
type: _is.getType<String>(),
|
|
||||||
nullable: false,
|
|
||||||
),
|
|
||||||
'password': _is.ParameterDescription(
|
|
||||||
name: 'password',
|
|
||||||
type: _is.getType<String>(),
|
|
||||||
nullable: false,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
call:
|
|
||||||
(
|
|
||||||
_is.Session session,
|
|
||||||
Map<String, dynamic> params,
|
|
||||||
) async =>
|
|
||||||
(endpoints['emailIdp'] as _iuc1hd5t.EmailIdpEndpoint).login(
|
|
||||||
session,
|
|
||||||
email: params['email'],
|
|
||||||
password: params['password'],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'startRegistration': _is.MethodConnector(
|
|
||||||
name: 'startRegistration',
|
|
||||||
params: {
|
|
||||||
'email': _is.ParameterDescription(
|
|
||||||
name: 'email',
|
|
||||||
type: _is.getType<String>(),
|
|
||||||
nullable: false,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
call:
|
|
||||||
(
|
|
||||||
_is.Session session,
|
|
||||||
Map<String, dynamic> params,
|
|
||||||
) async => (endpoints['emailIdp'] as _iuc1hd5t.EmailIdpEndpoint)
|
|
||||||
.startRegistration(
|
|
||||||
session,
|
|
||||||
email: params['email'],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'verifyRegistrationCode': _is.MethodConnector(
|
|
||||||
name: 'verifyRegistrationCode',
|
|
||||||
params: {
|
|
||||||
'accountRequestId': _is.ParameterDescription(
|
|
||||||
name: 'accountRequestId',
|
|
||||||
type: _is.getType<_is.UuidValue>(),
|
|
||||||
nullable: false,
|
|
||||||
),
|
|
||||||
'verificationCode': _is.ParameterDescription(
|
|
||||||
name: 'verificationCode',
|
|
||||||
type: _is.getType<String>(),
|
|
||||||
nullable: false,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
call:
|
|
||||||
(
|
|
||||||
_is.Session session,
|
|
||||||
Map<String, dynamic> params,
|
|
||||||
) async => (endpoints['emailIdp'] as _iuc1hd5t.EmailIdpEndpoint)
|
|
||||||
.verifyRegistrationCode(
|
|
||||||
session,
|
|
||||||
accountRequestId: params['accountRequestId'],
|
|
||||||
verificationCode: params['verificationCode'],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'finishRegistration': _is.MethodConnector(
|
|
||||||
name: 'finishRegistration',
|
|
||||||
params: {
|
|
||||||
'registrationToken': _is.ParameterDescription(
|
|
||||||
name: 'registrationToken',
|
|
||||||
type: _is.getType<String>(),
|
|
||||||
nullable: false,
|
|
||||||
),
|
|
||||||
'password': _is.ParameterDescription(
|
|
||||||
name: 'password',
|
|
||||||
type: _is.getType<String>(),
|
|
||||||
nullable: false,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
call:
|
|
||||||
(
|
|
||||||
_is.Session session,
|
|
||||||
Map<String, dynamic> params,
|
|
||||||
) async => (endpoints['emailIdp'] as _iuc1hd5t.EmailIdpEndpoint)
|
|
||||||
.finishRegistration(
|
|
||||||
session,
|
|
||||||
registrationToken: params['registrationToken'],
|
|
||||||
password: params['password'],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'startPasswordReset': _is.MethodConnector(
|
|
||||||
name: 'startPasswordReset',
|
|
||||||
params: {
|
|
||||||
'email': _is.ParameterDescription(
|
|
||||||
name: 'email',
|
|
||||||
type: _is.getType<String>(),
|
|
||||||
nullable: false,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
call:
|
|
||||||
(
|
|
||||||
_is.Session session,
|
|
||||||
Map<String, dynamic> params,
|
|
||||||
) async => (endpoints['emailIdp'] as _iuc1hd5t.EmailIdpEndpoint)
|
|
||||||
.startPasswordReset(
|
|
||||||
session,
|
|
||||||
email: params['email'],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'verifyPasswordResetCode': _is.MethodConnector(
|
|
||||||
name: 'verifyPasswordResetCode',
|
|
||||||
params: {
|
|
||||||
'passwordResetRequestId': _is.ParameterDescription(
|
|
||||||
name: 'passwordResetRequestId',
|
|
||||||
type: _is.getType<_is.UuidValue>(),
|
|
||||||
nullable: false,
|
|
||||||
),
|
|
||||||
'verificationCode': _is.ParameterDescription(
|
|
||||||
name: 'verificationCode',
|
|
||||||
type: _is.getType<String>(),
|
|
||||||
nullable: false,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
call:
|
|
||||||
(
|
|
||||||
_is.Session session,
|
|
||||||
Map<String, dynamic> params,
|
|
||||||
) async => (endpoints['emailIdp'] as _iuc1hd5t.EmailIdpEndpoint)
|
|
||||||
.verifyPasswordResetCode(
|
|
||||||
session,
|
|
||||||
passwordResetRequestId: params['passwordResetRequestId'],
|
|
||||||
verificationCode: params['verificationCode'],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'finishPasswordReset': _is.MethodConnector(
|
|
||||||
name: 'finishPasswordReset',
|
|
||||||
params: {
|
|
||||||
'finishPasswordResetToken': _is.ParameterDescription(
|
|
||||||
name: 'finishPasswordResetToken',
|
|
||||||
type: _is.getType<String>(),
|
|
||||||
nullable: false,
|
|
||||||
),
|
|
||||||
'newPassword': _is.ParameterDescription(
|
|
||||||
name: 'newPassword',
|
|
||||||
type: _is.getType<String>(),
|
|
||||||
nullable: false,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
call:
|
|
||||||
(
|
|
||||||
_is.Session session,
|
|
||||||
Map<String, dynamic> params,
|
|
||||||
) async => (endpoints['emailIdp'] as _iuc1hd5t.EmailIdpEndpoint)
|
|
||||||
.finishPasswordReset(
|
|
||||||
session,
|
|
||||||
finishPasswordResetToken:
|
|
||||||
params['finishPasswordResetToken'],
|
|
||||||
newPassword: params['newPassword'],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'hasAccount': _is.MethodConnector(
|
|
||||||
name: 'hasAccount',
|
|
||||||
params: {},
|
|
||||||
call:
|
|
||||||
(
|
|
||||||
_is.Session session,
|
|
||||||
Map<String, dynamic> params,
|
|
||||||
) async => (endpoints['emailIdp'] as _iuc1hd5t.EmailIdpEndpoint)
|
|
||||||
.hasAccount(session),
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
connectors['jwtRefresh'] = _is.EndpointConnector(
|
|
||||||
name: 'jwtRefresh',
|
|
||||||
endpoint: endpoints['jwtRefresh']!,
|
|
||||||
methodConnectors: {
|
|
||||||
'refreshAccessToken': _is.MethodConnector(
|
|
||||||
name: 'refreshAccessToken',
|
|
||||||
params: {
|
|
||||||
'refreshToken': _is.ParameterDescription(
|
|
||||||
name: 'refreshToken',
|
|
||||||
type: _is.getType<String?>(),
|
|
||||||
nullable: true,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
call:
|
|
||||||
(
|
|
||||||
_is.Session session,
|
|
||||||
Map<String, dynamic> params,
|
|
||||||
) async =>
|
|
||||||
(endpoints['jwtRefresh'] as _inwq3ztq.JwtRefreshEndpoint)
|
|
||||||
.refreshAccessToken(
|
|
||||||
session,
|
|
||||||
refreshToken: params['refreshToken'],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
modules['serverpod_auth_idp'] = _iais.Endpoints()
|
modules['serverpod_auth_idp'] = _iais.Endpoints()
|
||||||
..initializeEndpoints(server);
|
..initializeEndpoints(server);
|
||||||
modules['serverpod_auth_core'] = _iacs.Endpoints()
|
modules['serverpod_auth_core'] = _iacs.Endpoints()
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
emailIdp:
|
|
||||||
- login:
|
|
||||||
- startRegistration:
|
|
||||||
- verifyRegistrationCode:
|
|
||||||
- finishRegistration:
|
|
||||||
- startPasswordReset:
|
|
||||||
- verifyPasswordResetCode:
|
|
||||||
- finishPasswordReset:
|
|
||||||
- hasAccount:
|
|
||||||
jwtRefresh:
|
|
||||||
- refreshAccessToken:
|
|
||||||
|
|
@ -11,11 +11,8 @@
|
||||||
// ignore_for_file: no_leading_underscores_for_local_identifiers
|
// ignore_for_file: no_leading_underscores_for_local_identifiers
|
||||||
|
|
||||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||||
import 'dart:async' as _ida;
|
|
||||||
import 'dart:io' as _idi;
|
import 'dart:io' as _idi;
|
||||||
import 'package:serverpod/serverpod.dart' as _is;
|
import 'package:serverpod/serverpod.dart' as _is;
|
||||||
import 'package:serverpod_auth_core_server/serverpod_auth_core_server.dart'
|
|
||||||
as _iacs;
|
|
||||||
import 'package:serverpod_test/serverpod_test.dart' as _ist;
|
import 'package:serverpod_test/serverpod_test.dart' as _ist;
|
||||||
import 'package:halkyon_learn_server/src/generated/protocol.dart';
|
import 'package:halkyon_learn_server/src/generated/protocol.dart';
|
||||||
import 'package:halkyon_learn_server/src/generated/endpoints.dart';
|
import 'package:halkyon_learn_server/src/generated/endpoints.dart';
|
||||||
|
|
@ -144,11 +141,7 @@ void withServerpod(
|
||||||
)(testClosure);
|
)(testClosure);
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestEndpoints {
|
class TestEndpoints {}
|
||||||
late final _EmailIdpEndpoint emailIdp;
|
|
||||||
|
|
||||||
late final _JwtRefreshEndpoint jwtRefresh;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _InternalTestEndpoints extends TestEndpoints
|
class _InternalTestEndpoints extends TestEndpoints
|
||||||
implements _ist.InternalTestEndpoints {
|
implements _ist.InternalTestEndpoints {
|
||||||
|
|
@ -156,332 +149,5 @@ class _InternalTestEndpoints extends TestEndpoints
|
||||||
void initialize(
|
void initialize(
|
||||||
_is.SerializationManager serializationManager,
|
_is.SerializationManager serializationManager,
|
||||||
_is.EndpointDispatch endpoints,
|
_is.EndpointDispatch endpoints,
|
||||||
) {
|
) {}
|
||||||
emailIdp = _EmailIdpEndpoint(
|
|
||||||
endpoints,
|
|
||||||
serializationManager,
|
|
||||||
);
|
|
||||||
jwtRefresh = _JwtRefreshEndpoint(
|
|
||||||
endpoints,
|
|
||||||
serializationManager,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class _EmailIdpEndpoint {
|
|
||||||
_EmailIdpEndpoint(
|
|
||||||
this._endpointDispatch,
|
|
||||||
this._serializationManager,
|
|
||||||
);
|
|
||||||
|
|
||||||
final _is.EndpointDispatch _endpointDispatch;
|
|
||||||
|
|
||||||
final _is.SerializationManager _serializationManager;
|
|
||||||
|
|
||||||
_ida.Future<_iacs.AuthSuccess> login(
|
|
||||||
_ist.TestSessionBuilder sessionBuilder, {
|
|
||||||
required String email,
|
|
||||||
required String password,
|
|
||||||
}) async {
|
|
||||||
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
|
|
||||||
var _localUniqueSession =
|
|
||||||
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
|
|
||||||
endpoint: 'emailIdp',
|
|
||||||
method: 'login',
|
|
||||||
);
|
|
||||||
try {
|
|
||||||
var _localCallContext = await _endpointDispatch.getMethodCallContext(
|
|
||||||
createSessionCallback: (_) => _localUniqueSession,
|
|
||||||
endpointPath: 'emailIdp',
|
|
||||||
methodName: 'login',
|
|
||||||
parameters: _ist.testObjectToJson({
|
|
||||||
'email': email,
|
|
||||||
'password': password,
|
|
||||||
}),
|
|
||||||
serializationManager: _serializationManager,
|
|
||||||
);
|
|
||||||
var _localReturnValue =
|
|
||||||
await (_localCallContext.method.call(
|
|
||||||
_localUniqueSession,
|
|
||||||
_localCallContext.arguments,
|
|
||||||
)
|
|
||||||
as _ida.Future<_iacs.AuthSuccess>);
|
|
||||||
return _localReturnValue;
|
|
||||||
} finally {
|
|
||||||
await _localUniqueSession.close();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
_ida.Future<_is.UuidValue> startRegistration(
|
|
||||||
_ist.TestSessionBuilder sessionBuilder, {
|
|
||||||
required String email,
|
|
||||||
}) async {
|
|
||||||
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
|
|
||||||
var _localUniqueSession =
|
|
||||||
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
|
|
||||||
endpoint: 'emailIdp',
|
|
||||||
method: 'startRegistration',
|
|
||||||
);
|
|
||||||
try {
|
|
||||||
var _localCallContext = await _endpointDispatch.getMethodCallContext(
|
|
||||||
createSessionCallback: (_) => _localUniqueSession,
|
|
||||||
endpointPath: 'emailIdp',
|
|
||||||
methodName: 'startRegistration',
|
|
||||||
parameters: _ist.testObjectToJson({'email': email}),
|
|
||||||
serializationManager: _serializationManager,
|
|
||||||
);
|
|
||||||
var _localReturnValue =
|
|
||||||
await (_localCallContext.method.call(
|
|
||||||
_localUniqueSession,
|
|
||||||
_localCallContext.arguments,
|
|
||||||
)
|
|
||||||
as _ida.Future<_is.UuidValue>);
|
|
||||||
return _localReturnValue;
|
|
||||||
} finally {
|
|
||||||
await _localUniqueSession.close();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
_ida.Future<String> verifyRegistrationCode(
|
|
||||||
_ist.TestSessionBuilder sessionBuilder, {
|
|
||||||
required _is.UuidValue accountRequestId,
|
|
||||||
required String verificationCode,
|
|
||||||
}) async {
|
|
||||||
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
|
|
||||||
var _localUniqueSession =
|
|
||||||
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
|
|
||||||
endpoint: 'emailIdp',
|
|
||||||
method: 'verifyRegistrationCode',
|
|
||||||
);
|
|
||||||
try {
|
|
||||||
var _localCallContext = await _endpointDispatch.getMethodCallContext(
|
|
||||||
createSessionCallback: (_) => _localUniqueSession,
|
|
||||||
endpointPath: 'emailIdp',
|
|
||||||
methodName: 'verifyRegistrationCode',
|
|
||||||
parameters: _ist.testObjectToJson({
|
|
||||||
'accountRequestId': accountRequestId,
|
|
||||||
'verificationCode': verificationCode,
|
|
||||||
}),
|
|
||||||
serializationManager: _serializationManager,
|
|
||||||
);
|
|
||||||
var _localReturnValue =
|
|
||||||
await (_localCallContext.method.call(
|
|
||||||
_localUniqueSession,
|
|
||||||
_localCallContext.arguments,
|
|
||||||
)
|
|
||||||
as _ida.Future<String>);
|
|
||||||
return _localReturnValue;
|
|
||||||
} finally {
|
|
||||||
await _localUniqueSession.close();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
_ida.Future<_iacs.AuthSuccess> finishRegistration(
|
|
||||||
_ist.TestSessionBuilder sessionBuilder, {
|
|
||||||
required String registrationToken,
|
|
||||||
required String password,
|
|
||||||
}) async {
|
|
||||||
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
|
|
||||||
var _localUniqueSession =
|
|
||||||
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
|
|
||||||
endpoint: 'emailIdp',
|
|
||||||
method: 'finishRegistration',
|
|
||||||
);
|
|
||||||
try {
|
|
||||||
var _localCallContext = await _endpointDispatch.getMethodCallContext(
|
|
||||||
createSessionCallback: (_) => _localUniqueSession,
|
|
||||||
endpointPath: 'emailIdp',
|
|
||||||
methodName: 'finishRegistration',
|
|
||||||
parameters: _ist.testObjectToJson({
|
|
||||||
'registrationToken': registrationToken,
|
|
||||||
'password': password,
|
|
||||||
}),
|
|
||||||
serializationManager: _serializationManager,
|
|
||||||
);
|
|
||||||
var _localReturnValue =
|
|
||||||
await (_localCallContext.method.call(
|
|
||||||
_localUniqueSession,
|
|
||||||
_localCallContext.arguments,
|
|
||||||
)
|
|
||||||
as _ida.Future<_iacs.AuthSuccess>);
|
|
||||||
return _localReturnValue;
|
|
||||||
} finally {
|
|
||||||
await _localUniqueSession.close();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
_ida.Future<_is.UuidValue> startPasswordReset(
|
|
||||||
_ist.TestSessionBuilder sessionBuilder, {
|
|
||||||
required String email,
|
|
||||||
}) async {
|
|
||||||
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
|
|
||||||
var _localUniqueSession =
|
|
||||||
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
|
|
||||||
endpoint: 'emailIdp',
|
|
||||||
method: 'startPasswordReset',
|
|
||||||
);
|
|
||||||
try {
|
|
||||||
var _localCallContext = await _endpointDispatch.getMethodCallContext(
|
|
||||||
createSessionCallback: (_) => _localUniqueSession,
|
|
||||||
endpointPath: 'emailIdp',
|
|
||||||
methodName: 'startPasswordReset',
|
|
||||||
parameters: _ist.testObjectToJson({'email': email}),
|
|
||||||
serializationManager: _serializationManager,
|
|
||||||
);
|
|
||||||
var _localReturnValue =
|
|
||||||
await (_localCallContext.method.call(
|
|
||||||
_localUniqueSession,
|
|
||||||
_localCallContext.arguments,
|
|
||||||
)
|
|
||||||
as _ida.Future<_is.UuidValue>);
|
|
||||||
return _localReturnValue;
|
|
||||||
} finally {
|
|
||||||
await _localUniqueSession.close();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
_ida.Future<String> verifyPasswordResetCode(
|
|
||||||
_ist.TestSessionBuilder sessionBuilder, {
|
|
||||||
required _is.UuidValue passwordResetRequestId,
|
|
||||||
required String verificationCode,
|
|
||||||
}) async {
|
|
||||||
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
|
|
||||||
var _localUniqueSession =
|
|
||||||
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
|
|
||||||
endpoint: 'emailIdp',
|
|
||||||
method: 'verifyPasswordResetCode',
|
|
||||||
);
|
|
||||||
try {
|
|
||||||
var _localCallContext = await _endpointDispatch.getMethodCallContext(
|
|
||||||
createSessionCallback: (_) => _localUniqueSession,
|
|
||||||
endpointPath: 'emailIdp',
|
|
||||||
methodName: 'verifyPasswordResetCode',
|
|
||||||
parameters: _ist.testObjectToJson({
|
|
||||||
'passwordResetRequestId': passwordResetRequestId,
|
|
||||||
'verificationCode': verificationCode,
|
|
||||||
}),
|
|
||||||
serializationManager: _serializationManager,
|
|
||||||
);
|
|
||||||
var _localReturnValue =
|
|
||||||
await (_localCallContext.method.call(
|
|
||||||
_localUniqueSession,
|
|
||||||
_localCallContext.arguments,
|
|
||||||
)
|
|
||||||
as _ida.Future<String>);
|
|
||||||
return _localReturnValue;
|
|
||||||
} finally {
|
|
||||||
await _localUniqueSession.close();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
_ida.Future<void> finishPasswordReset(
|
|
||||||
_ist.TestSessionBuilder sessionBuilder, {
|
|
||||||
required String finishPasswordResetToken,
|
|
||||||
required String newPassword,
|
|
||||||
}) async {
|
|
||||||
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
|
|
||||||
var _localUniqueSession =
|
|
||||||
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
|
|
||||||
endpoint: 'emailIdp',
|
|
||||||
method: 'finishPasswordReset',
|
|
||||||
);
|
|
||||||
try {
|
|
||||||
var _localCallContext = await _endpointDispatch.getMethodCallContext(
|
|
||||||
createSessionCallback: (_) => _localUniqueSession,
|
|
||||||
endpointPath: 'emailIdp',
|
|
||||||
methodName: 'finishPasswordReset',
|
|
||||||
parameters: _ist.testObjectToJson({
|
|
||||||
'finishPasswordResetToken': finishPasswordResetToken,
|
|
||||||
'newPassword': newPassword,
|
|
||||||
}),
|
|
||||||
serializationManager: _serializationManager,
|
|
||||||
);
|
|
||||||
var _localReturnValue =
|
|
||||||
await (_localCallContext.method.call(
|
|
||||||
_localUniqueSession,
|
|
||||||
_localCallContext.arguments,
|
|
||||||
)
|
|
||||||
as _ida.Future<void>);
|
|
||||||
return _localReturnValue;
|
|
||||||
} finally {
|
|
||||||
await _localUniqueSession.close();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
_ida.Future<bool> hasAccount(_ist.TestSessionBuilder sessionBuilder) async {
|
|
||||||
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
|
|
||||||
var _localUniqueSession =
|
|
||||||
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
|
|
||||||
endpoint: 'emailIdp',
|
|
||||||
method: 'hasAccount',
|
|
||||||
);
|
|
||||||
try {
|
|
||||||
var _localCallContext = await _endpointDispatch.getMethodCallContext(
|
|
||||||
createSessionCallback: (_) => _localUniqueSession,
|
|
||||||
endpointPath: 'emailIdp',
|
|
||||||
methodName: 'hasAccount',
|
|
||||||
parameters: _ist.testObjectToJson({}),
|
|
||||||
serializationManager: _serializationManager,
|
|
||||||
);
|
|
||||||
var _localReturnValue =
|
|
||||||
await (_localCallContext.method.call(
|
|
||||||
_localUniqueSession,
|
|
||||||
_localCallContext.arguments,
|
|
||||||
)
|
|
||||||
as _ida.Future<bool>);
|
|
||||||
return _localReturnValue;
|
|
||||||
} finally {
|
|
||||||
await _localUniqueSession.close();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class _JwtRefreshEndpoint {
|
|
||||||
_JwtRefreshEndpoint(
|
|
||||||
this._endpointDispatch,
|
|
||||||
this._serializationManager,
|
|
||||||
);
|
|
||||||
|
|
||||||
final _is.EndpointDispatch _endpointDispatch;
|
|
||||||
|
|
||||||
final _is.SerializationManager _serializationManager;
|
|
||||||
|
|
||||||
_ida.Future<_iacs.AuthSuccess> refreshAccessToken(
|
|
||||||
_ist.TestSessionBuilder sessionBuilder, {
|
|
||||||
String? refreshToken,
|
|
||||||
}) async {
|
|
||||||
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
|
|
||||||
var _localUniqueSession =
|
|
||||||
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
|
|
||||||
endpoint: 'jwtRefresh',
|
|
||||||
method: 'refreshAccessToken',
|
|
||||||
);
|
|
||||||
try {
|
|
||||||
var _localCallContext = await _endpointDispatch.getMethodCallContext(
|
|
||||||
createSessionCallback: (_) => _localUniqueSession,
|
|
||||||
endpointPath: 'jwtRefresh',
|
|
||||||
methodName: 'refreshAccessToken',
|
|
||||||
parameters: _ist.testObjectToJson({'refreshToken': refreshToken}),
|
|
||||||
serializationManager: _serializationManager,
|
|
||||||
);
|
|
||||||
var _localReturnValue =
|
|
||||||
await (_localCallContext.method.call(
|
|
||||||
_localUniqueSession,
|
|
||||||
_localCallContext.arguments,
|
|
||||||
)
|
|
||||||
as _ida.Future<_iacs.AuthSuccess>);
|
|
||||||
return _localReturnValue;
|
|
||||||
} finally {
|
|
||||||
await _localUniqueSession.close();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue