Skip to content

Commit 130a938

Browse files
committed
Initial Auth construct
1 parent 5530b2d commit 130a938

File tree

5 files changed

+51
-0
lines changed

5 files changed

+51
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import 'package:celest/celest.dart';
2+
3+
const auth = Auth(
4+
providers: [
5+
AuthProvider.google(),
6+
],
7+
);

packages/celest/lib/celest.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ library celest;
33

44
export 'package:celest_core/celest_core.dart';
55

6+
/// Auth
7+
export 'src/auth/auth.dart';
8+
export 'src/auth/auth_provider.dart';
9+
610
/// Config
711
export 'src/config/env.dart';
812

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import 'package:celest/src/auth/auth_provider.dart';
2+
3+
/// {@template celest.auth.auth}
4+
/// The authentication component of your Celest project.
5+
///
6+
/// The Auth widget defines the authentication providers which can be used to
7+
/// sign in to your Celest project.
8+
/// {@endtemplate}
9+
final class Auth {
10+
/// {@macro celest.auth.auth}
11+
const Auth({
12+
required this.providers,
13+
});
14+
15+
/// The authentication providers which can be used by your users when signing
16+
/// in.
17+
final List<AuthProvider> providers;
18+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/// {@template celest.auth.auth_provider}
2+
/// An authentication provider which can be used to sign in to Celest.
3+
///
4+
/// Currently, Celest supports the following authentication methods:
5+
/// - [AuthProvider.google] Sign in with Google
6+
/// {@endtemplate}
7+
sealed class AuthProvider {
8+
const AuthProvider();
9+
10+
/// A provider which enables Sign in with Google.
11+
const factory AuthProvider.google() = _GoogleAuthProvider;
12+
}
13+
14+
final class _GoogleAuthProvider extends AuthProvider {
15+
const _GoogleAuthProvider();
16+
}

packages/celest/lib/src/core/project.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@ class Project implements CloudWidget {
1111
/// {@macro celest.core.project}
1212
const Project({
1313
required this.name,
14+
this.logoUrl,
1415
});
1516

1617
/// The name of the project as its identified in your Celest backend.
1718
final String name;
19+
20+
/// The hosted URL of your project's logo.
21+
///
22+
/// This is used by widgets like [Auth] to craft a custom login page.
23+
final String? logoUrl;
1824
}

0 commit comments

Comments
 (0)