21 lines
No EOL
544 B
Dart
21 lines
No EOL
544 B
Dart
import 'package:gitea_client/model/ApiAccess.dart';
|
|
import 'package:gitea_client/service/gitea_service.dart';
|
|
|
|
import '../model/user.dart';
|
|
|
|
class AuthenticationChecker {
|
|
final ApiAccess apiAccess;
|
|
late GiteaService service;
|
|
AuthenticationChecker(this.apiAccess) {
|
|
service = GiteaService(apiAccess: apiAccess);
|
|
}
|
|
|
|
Future<User> getAuthenticatedUserOrError() async{
|
|
final user = await service.getAuthenticatedUser();
|
|
if(user.username != null) {
|
|
return user;
|
|
}
|
|
throw Exception("Authentication failed");
|
|
}
|
|
|
|
} |