Skip to content

Commit

Permalink
Initial Auth construct
Browse files Browse the repository at this point in the history
  • Loading branch information
dnys1 committed Feb 11, 2024
1 parent 5530b2d commit 130a938
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/celest/example/celest/auth/auth.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import 'package:celest/celest.dart';

const auth = Auth(
providers: [
AuthProvider.google(),
],
);
4 changes: 4 additions & 0 deletions packages/celest/lib/celest.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ library celest;

export 'package:celest_core/celest_core.dart';

/// Auth
export 'src/auth/auth.dart';
export 'src/auth/auth_provider.dart';

/// Config
export 'src/config/env.dart';

Expand Down
18 changes: 18 additions & 0 deletions packages/celest/lib/src/auth/auth.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import 'package:celest/src/auth/auth_provider.dart';

/// {@template celest.auth.auth}
/// The authentication component of your Celest project.
///
/// The Auth widget defines the authentication providers which can be used to
/// sign in to your Celest project.
/// {@endtemplate}
final class Auth {
/// {@macro celest.auth.auth}
const Auth({
required this.providers,
});

/// The authentication providers which can be used by your users when signing
/// in.
final List<AuthProvider> providers;
}
16 changes: 16 additions & 0 deletions packages/celest/lib/src/auth/auth_provider.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/// {@template celest.auth.auth_provider}
/// An authentication provider which can be used to sign in to Celest.
///
/// Currently, Celest supports the following authentication methods:
/// - [AuthProvider.google] Sign in with Google
/// {@endtemplate}
sealed class AuthProvider {
const AuthProvider();

/// A provider which enables Sign in with Google.
const factory AuthProvider.google() = _GoogleAuthProvider;
}

final class _GoogleAuthProvider extends AuthProvider {
const _GoogleAuthProvider();
}
6 changes: 6 additions & 0 deletions packages/celest/lib/src/core/project.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ class Project implements CloudWidget {
/// {@macro celest.core.project}
const Project({
required this.name,
this.logoUrl,
});

/// The name of the project as its identified in your Celest backend.
final String name;

/// The hosted URL of your project's logo.
///
/// This is used by widgets like [Auth] to craft a custom login page.
final String? logoUrl;
}

0 comments on commit 130a938

Please sign in to comment.