2026-09-16 19:24:59 +02:00
|
|
|
import 'package:serverpod_auth_idp_server/core.dart';
|
|
|
|
|
|
|
|
|
|
import 'src/generated/serverpod.dart';
|
|
|
|
|
|
|
|
|
|
/// The starting point of the Serverpod server.
|
|
|
|
|
void run(List<String> args) async {
|
|
|
|
|
// Initialize Serverpod. The generated Serverpod class is already connected
|
|
|
|
|
// with your project's generated code.
|
|
|
|
|
final pod = Serverpod(args);
|
|
|
|
|
|
|
|
|
|
// Initialize authentication services for the server.
|
|
|
|
|
// Token managers will be used to validate and issue authentication keys,
|
|
|
|
|
// and the identity providers will be the authentication options available for users.
|
|
|
|
|
pod.initializeAuthServices(
|
|
|
|
|
tokenManagerBuilders: [
|
2026-09-24 14:41:31 +02:00
|
|
|
// Server-side sessions: revocable immediately, scopes live on the session row.
|
|
|
|
|
// No absolute lifetime (anonymous session cannot be restored). The inactivity
|
|
|
|
|
// timeout matches the pruning policy for abandoned accounts.
|
|
|
|
|
ServerSideSessionsConfigFromPasswords(
|
|
|
|
|
defaultSessionInactivityTimeout: const Duration(days: 90),
|
2026-09-16 19:24:59 +02:00
|
|
|
),
|
|
|
|
|
],
|
2026-09-24 14:41:31 +02:00
|
|
|
identityProviderBuilders: [],
|
2026-09-16 19:24:59 +02:00
|
|
|
);
|
|
|
|
|
|
2026-09-24 15:02:52 +02:00
|
|
|
// Files live in Postgres until the self-hosted S3-compatible storage arrives later.
|
|
|
|
|
pod.addCloudStorage(DatabaseCloudStorage('private'));
|
|
|
|
|
pod.addCloudStorage(DatabaseCloudStorage('public'));
|
2026-09-16 19:24:59 +02:00
|
|
|
|
|
|
|
|
// Start the server.
|
|
|
|
|
await pod.start();
|
|
|
|
|
}
|