diff --git a/.github/workflows/celest_cloud_auth.yaml b/.github/workflows/celest_cloud_auth.yaml new file mode 100644 index 00000000..0f9e1dd4 --- /dev/null +++ b/.github/workflows/celest_cloud_auth.yaml @@ -0,0 +1,51 @@ +name: celest_cloud_auth +on: + pull_request: + paths: + - ".github/workflows/celest_cloud_auth.yaml" + - "services/celest_cloud_auth/**" + +# Prevent duplicate runs due to Graphite +# https://graphite.dev/docs/troubleshooting#why-are-my-actions-running-twice +concurrency: + group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}-${{ github.ref == 'refs/heads/main' && github.sha || ''}} + cancel-in-progress: true + +jobs: + analyze_and_format: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Git Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # 4.1.7 + - name: Setup Flutter + uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # 2.16.0 + with: + cache: true + - name: Setup Melos + run: dart pub global activate melos + - name: Get Packages + run: melos bootstrap + - name: Analyze + working-directory: packages/celest_cloud_auth + run: dart analyze + - name: Format + working-directory: packages/celest_cloud_auth + run: dart format --set-exit-if-changed . + test: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - name: Git Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # 4.1.7 + - name: Setup Flutter + uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # 2.16.0 + with: + cache: true + - name: Setup Melos + run: dart pub global activate melos + - name: Get Packages + run: melos bootstrap + - name: Test + working-directory: packages/celest_cloud_auth + run: dart test diff --git a/README.md b/README.md index 6bb2374f..e00acc44 100644 --- a/README.md +++ b/README.md @@ -134,11 +134,17 @@ You have now set up your Celest project and integrated it into your Flutter app. | Package | Description | Pub | Checks | | -------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [celest](packages/celest/) | The main package for defining Celest backends. | | [![Celest](https://github.com/celest-dev/celest/actions/workflows/celest.yaml/badge.svg)](https://github.com/celest-dev/celest/actions/workflows/celest.yaml) | -| [celest_ast](packages/celest_ast/) | A structured representation of Celest projects. | | [![Celest AST](https://github.com/celest-dev/celest/actions/workflows/celest_ast.yaml/badge.svg)](https://github.com/celest-dev/celest/actions/workflows/celest_ast.yaml) | +| [celest_ast](packages/celest_ast/) | A structured representation of Celest projects. | | [![Celest AST](https://github.com/celest-dev/celest/actions/workflows/celest_ast.yaml/badge.svg)](https://github.com/celest-dev/celest/actions/workflows/celest_ast.yaml) | | [celest_auth](packages/celest_auth/) | The authentication and authorization runtimes for Celest. | | [![Celest Auth](https://github.com/celest-dev/celest/actions/workflows/celest_auth.yaml/badge.svg)](https://github.com/celest-dev/celest/actions/workflows/celest_auth.yaml) | | [celest_cloud](packages/celest_cloud/) | API contracts and Dart clients for the Celest Cloud platform. | | [![Celest Cloud](https://github.com/celest-dev/celest/actions/workflows/celest_cloud.yaml/badge.svg)](https://github.com/celest-dev/celest/actions/workflows/celest_cloud.yaml) | | [celest_core](packages/celest_core/) | Core types and utilities shared between Celest packages. | | [![Celest Core](https://github.com/celest-dev/celest/actions/workflows/celest_core.yaml/badge.svg)](https://github.com/celest-dev/celest/actions/workflows/celest_core.yaml) | +## Services + +| Service | Description | Pub | Checks | +| ------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [celest_cloud_auth](packages/celest_cloud_auth/) | A Dart-native authentication and authorization solution built on [Cedar](https://github.com/celest-dev/cedar-dart) and Celest Data. | | [![Celest Cloud Auth](https://github.com/celest-dev/celest/actions/workflows/celest_cloud_auth.yaml/badge.svg)](https://github.com/celest-dev/celest/actions/workflows/celest_cloud_auth.yaml) | + ## License This repo is licensed under the [BSD-2-Clause-Patent](https://spdx.org/licenses/BSD-2-Clause-Patent.html) license. See [LICENSE.md](LICENSE.md) for the full text. diff --git a/assets/analyzer-plugin.gif b/assets/analyzer-plugin.gif new file mode 100644 index 00000000..02d0b831 Binary files /dev/null and b/assets/analyzer-plugin.gif differ diff --git a/examples/gemini/celest/client/pubspec.yaml b/examples/gemini/celest/client/pubspec.yaml index 6548f180..49ac9894 100644 --- a/examples/gemini/celest/client/pubspec.yaml +++ b/examples/gemini/celest/client/pubspec.yaml @@ -6,10 +6,10 @@ environment: sdk: ^3.4.0 dependencies: - celest: ^1.0.0-0 + celest: ^1.0.0 celest_backend: path: .. - celest_core: ^1.0.0-0 + celest_core: ^1.0.0 http: ^1.0.0 meta: ^1.12.0 native_storage: ^0.2.2 diff --git a/examples/gemini/celest/pubspec.yaml b/examples/gemini/celest/pubspec.yaml index f5553c00..0a71d916 100644 --- a/examples/gemini/celest/pubspec.yaml +++ b/examples/gemini/celest/pubspec.yaml @@ -6,9 +6,9 @@ environment: sdk: ^3.4.0 dependencies: - celest: ^1.0.0-0 + celest: ^1.0.0 celest_ast: ^0.1.0 - celest_core: ^1.0.0-0 + celest_core: ^1.0.0 google_generative_ai: ^0.2.0 http: '>=0.13.0 <2.0.0' meta: ^1.12.0 diff --git a/examples/openai/celest/client/pubspec.yaml b/examples/openai/celest/client/pubspec.yaml index 76164d3f..f835719c 100644 --- a/examples/openai/celest/client/pubspec.yaml +++ b/examples/openai/celest/client/pubspec.yaml @@ -6,10 +6,10 @@ environment: sdk: ^3.4.0 dependencies: - celest: ^1.0.0-0 + celest: ^1.0.0 celest_backend: path: .. - celest_core: ^1.0.0-0 + celest_core: ^1.0.0 http: ^1.0.0 meta: ^1.12.0 native_storage: ^0.2.2 diff --git a/examples/openai/celest/pubspec.yaml b/examples/openai/celest/pubspec.yaml index cdf101d0..3c8dfba7 100644 --- a/examples/openai/celest/pubspec.yaml +++ b/examples/openai/celest/pubspec.yaml @@ -6,9 +6,9 @@ environment: sdk: ^3.4.0 dependencies: - celest: ^1.0.0-0 + celest: ^1.0.0 celest_ast: ^0.1.0 - celest_core: ^1.0.0-0 + celest_core: ^1.0.0 chat_gpt_sdk: ^2.2.8 http: '>=0.13.0 <2.0.0' meta: ^1.12.0 diff --git a/examples/tasks/celest/client/pubspec.yaml b/examples/tasks/celest/client/pubspec.yaml index f489861c..bd9a3db9 100644 --- a/examples/tasks/celest/client/pubspec.yaml +++ b/examples/tasks/celest/client/pubspec.yaml @@ -6,10 +6,10 @@ environment: sdk: ^3.4.0 dependencies: - celest: ^1.0.0-0 + celest: ^1.0.0 celest_backend: path: .. - celest_core: ^1.0.0-0 + celest_core: ^1.0.0 http: ^1.0.0 native_storage: ^0.2.2 diff --git a/examples/tasks/celest/lib/src/project.dart b/examples/tasks/celest/lib/src/project.dart index 3cc251fe..473dff35 100644 --- a/examples/tasks/celest/lib/src/project.dart +++ b/examples/tasks/celest/lib/src/project.dart @@ -1,9 +1,7 @@ import 'package:celest/celest.dart'; import 'package:celest_backend/src/database/task_database.dart'; -const project = Project( - name: 'tasks', -); +const project = Project(name: 'tasks'); const tasksDatabase = Database( schema: Schema.drift(TaskDatabase), diff --git a/examples/tasks/celest/pubspec.yaml b/examples/tasks/celest/pubspec.yaml index 7ed68a7f..0c32fec3 100644 --- a/examples/tasks/celest/pubspec.yaml +++ b/examples/tasks/celest/pubspec.yaml @@ -6,8 +6,8 @@ environment: sdk: ^3.4.0 dependencies: - celest: ^1.0.0-0 - celest_core: ^1.0.0-0 + celest: ^1.0.0 + celest_core: ^1.0.0 drift: ^2.20.3 drift_hrana: ^1.0.2 meta: ^1.12.0 diff --git a/packages/celest/CHANGELOG.md b/packages/celest/CHANGELOG.md index f74a788f..10c49db1 100644 --- a/packages/celest/CHANGELOG.md +++ b/packages/celest/CHANGELOG.md @@ -1,4 +1,74 @@ -## 1.0.0-dev.0 +## 1.0.0 + +The first release of Celest V1! This release includes: + +- **Celest Data** + + Celest Data is a brand new database offering from Celest built off of SQLite and [Drift](https://pub.dev/packages/drift). + + To get started with Celest Data, add a new `Database` component to your Celest project and point it at your Drift schema. + + ```dart + import 'package:celest/celest.dart'; + import 'package:celest_backend/src/database/task_database.dart'; + + const project = Project(name: 'tasks'); + + const tasksDatabase = Database( + schema: Schema.drift(TaskDatabase), + ); + ``` + + When you run Celest locally, Celest Data will use SQLite to store your data. And when you deploy your Celest project, Celest Data + will automatically switch to using Celest Data backed by [Turso](https://turso.tech/). + +- **Celest Cloud Auth** + + [Celest Cloud Auth](https://pub.dev/packages/celest_cloud_auth) is an open-source backend service for authenticating users and authorizing access to resources. It is built on the [Cedar](https://www.cedarpolicy.com/en) policy engine and Celest Data. + + Now, when adding [Auth]() to your Celest project, Celest will automatically generate the necessary code to integrate Celest Cloud + Auth into your project so you can start authenticating users and controlling the resources they can access. + + ```dart + import 'package:celest/celest.dart'; + + const project = Project(name: 'my-project'); + + const auth = Auth( + providers: [ + AuthProvider.email(), + ], + ); + ``` + +- **Self-Hosting** + + Celest now supports self-hosting your Celest project. You can run your Celest project on your own server or cloud provider. + This allows you to have full control over your backend and data. + + The new `celest build` command will automatically generate a `Dockerfile` which you can deploy to any server of your choice. + +- **Improved Developer Experience** + + We have made several improvements to the developer experience, including better error messages, improved documentation, and a + new Dart analyzer plugin which helps you more seamlessly navigate your code. Now, when using the `Go To Definition` feature in + your IDE, you will be taken directly from your frontend to your backend code. + +
+ + ![Go To Definition](https://github.com/celest-dev/celest/blob/master/assets/analyzer-plugin.gif) + +
+ +- **...and much more on the Roadmap!** + + We are excited to continue building out the Celest platform and have many more features planned for the future. Our initial release + of Celest V1 provides the foundation for many new features to come include server-side rendering of Flutter app, better integration + of your Data models and Auth policies, Web Hosting, Storage, and much more! + + Stay tuned for more updates by following us on [X](https://x.com/Celest_Dev) and joining our [Discord](https://celest.dev/discord). + +Flutter is the future! 🚀 ## 0.4.2 diff --git a/packages/celest/example/celest/client/pubspec.yaml b/packages/celest/example/celest/client/pubspec.yaml index 1b718e74..d5b13127 100644 --- a/packages/celest/example/celest/client/pubspec.yaml +++ b/packages/celest/example/celest/client/pubspec.yaml @@ -6,10 +6,10 @@ environment: sdk: ^3.4.0 dependencies: - celest: ^1.0.0-0 + celest: ^1.0.0 celest_backend: path: ../ - celest_core: ^1.0.0-0 + celest_core: ^1.0.0 http: ^1.0.0 native_storage: ^0.2.2 diff --git a/packages/celest/example/celest/pubspec.yaml b/packages/celest/example/celest/pubspec.yaml index 7a5b866d..339c618e 100644 --- a/packages/celest/example/celest/pubspec.yaml +++ b/packages/celest/example/celest/pubspec.yaml @@ -6,9 +6,9 @@ environment: sdk: ^3.4.0 dependencies: - celest: ^1.0.0-0 + celest: ^1.0.0 celest_ast: ^0.1.0 - celest_core: ^1.0.0-0 + celest_core: ^1.0.0 http: '>=0.13.0 <2.0.0' meta: ^1.12.0 diff --git a/packages/celest/pubspec.yaml b/packages/celest/pubspec.yaml index c50a0b09..ce86751e 100644 --- a/packages/celest/pubspec.yaml +++ b/packages/celest/pubspec.yaml @@ -1,6 +1,6 @@ name: celest description: The Flutter cloud platform. Celest enables you to build your entire backend in Dart. -version: 1.0.0-dev.0 +version: 1.0.0 homepage: https://celest.dev repository: https://github.com/celest-dev/celest/tree/main/packages/celest @@ -11,9 +11,9 @@ environment: dependencies: async: ^2.11.0 celest_ast: ^0.1.0 - celest_auth: 1.0.0-dev.0 + celest_auth: ^1.0.0 celest_cloud: ^0.1.1 - celest_core: 1.0.0-dev.0 + celest_core: ^1.0.0 chunked_stream: ^1.4.2 cloud_http: ^0.1.0 collection: ^1.18.0 diff --git a/packages/celest_auth/CHANGELOG.md b/packages/celest_auth/CHANGELOG.md index 561eb846..6e9a7334 100644 --- a/packages/celest_auth/CHANGELOG.md +++ b/packages/celest_auth/CHANGELOG.md @@ -1,4 +1,8 @@ -## 1.0.0-dev.0 +## 1.0.0 + +The first release of Celest V1! + +See the release notes for the [celest](https://pub.dev/packages/celest) package for more details. ## 0.4.1 diff --git a/packages/celest_auth/example/celest/client/pubspec.yaml b/packages/celest_auth/example/celest/client/pubspec.yaml index 7cea987d..f72359bc 100644 --- a/packages/celest_auth/example/celest/client/pubspec.yaml +++ b/packages/celest_auth/example/celest/client/pubspec.yaml @@ -6,10 +6,10 @@ environment: sdk: ^3.4.0 dependencies: - celest: ^1.0.0-0 + celest: ^1.0.0 celest_backend: path: ../ - celest_core: ^1.0.0-0 + celest_core: ^1.0.0 http: ^1.0.0 native_storage: ^0.2.2 diff --git a/packages/celest_auth/example/celest/pubspec.yaml b/packages/celest_auth/example/celest/pubspec.yaml index b3769b41..81fda25b 100644 --- a/packages/celest_auth/example/celest/pubspec.yaml +++ b/packages/celest_auth/example/celest/pubspec.yaml @@ -6,12 +6,12 @@ environment: sdk: ^3.4.0 dependencies: - celest: ^1.0.0-0 + celest: ^1.0.0 celest_ast: ^0.1.0 celest_auth: 'any' celest_cloud_auth: path: ../../../../services/celest_cloud_auth - celest_core: ^1.0.0-0 + celest_core: ^1.0.0 drift_hrana: ^1.0.2 http: '>=0.13.0 <2.0.0' meta: ^1.12.0 diff --git a/packages/celest_auth/pubspec.yaml b/packages/celest_auth/pubspec.yaml index bc626a9f..8281a2ba 100644 --- a/packages/celest_auth/pubspec.yaml +++ b/packages/celest_auth/pubspec.yaml @@ -1,6 +1,6 @@ name: celest_auth description: The Auth runtime and client library for Celest, the Flutter cloud platform. -version: 1.0.0-dev.0 +version: 1.0.0 homepage: https://celest.dev repository: https://github.com/celest-dev/celest/tree/main/packages/celest_auth @@ -14,7 +14,7 @@ dependencies: built_value: ^8.9.1 cedar: ^0.2.2 celest_cloud: ^0.1.0 - celest_core: 1.0.0-dev.0 + celest_core: ^1.0.0 chunked_stream: ^1.4.2 corks_cedar: ^0.2.1 ffi: ^2.1.2 diff --git a/packages/celest_cloud/lib/src/util/operations.dart b/packages/celest_cloud/lib/src/util/operations.dart index d7bbfffa..22a1996f 100644 --- a/packages/celest_cloud/lib/src/util/operations.dart +++ b/packages/celest_cloud/lib/src/util/operations.dart @@ -88,7 +88,7 @@ extension on Status { extension on T { T unpack(Any any) { - return any.unpackInto(this.createEmptyInstance() as T); + return any.unpackInto(createEmptyInstance() as T); } } diff --git a/packages/celest_cloud/pubspec.yaml b/packages/celest_cloud/pubspec.yaml index 97d6aa66..29402cb3 100644 --- a/packages/celest_cloud/pubspec.yaml +++ b/packages/celest_cloud/pubspec.yaml @@ -1,6 +1,6 @@ name: celest_cloud description: API contracts and Dart clients for the Celest Cloud platform. -version: 0.1.4-wip +version: 0.1.4 repository: https://github.com/celest-dev/celest environment: @@ -8,7 +8,7 @@ environment: dependencies: async: ^2.11.0 - celest_core: ^0.5.0-dev.1 + celest_core: ^1.0.0 code_builder: ^4.10.0 collection: ^1.18.0 fixnum: ^1.1.0 diff --git a/packages/celest_core/CHANGELOG.md b/packages/celest_core/CHANGELOG.md index 451f36f2..652353f6 100644 --- a/packages/celest_core/CHANGELOG.md +++ b/packages/celest_core/CHANGELOG.md @@ -1,4 +1,8 @@ -## 1.0.0-dev.0 +## 1.0.0 + +The first release of Celest V1! + +See the release notes for the [celest](https://pub.dev/packages/celest) package for more details. ## 0.4.2 diff --git a/packages/celest_core/pubspec.yaml b/packages/celest_core/pubspec.yaml index 68d01412..c3cadc19 100644 --- a/packages/celest_core/pubspec.yaml +++ b/packages/celest_core/pubspec.yaml @@ -1,6 +1,6 @@ name: celest_core description: Celest types and utilities shared between the client and the cloud. -version: 1.0.0-dev.0 +version: 1.0.0 homepage: https://celest.dev repository: https://github.com/celest-dev/celest/tree/main/packages/celest_core diff --git a/services/celest_cloud_auth/LICENSE b/services/celest_cloud_auth/LICENSE new file mode 100644 index 00000000..d8101f5c --- /dev/null +++ b/services/celest_cloud_auth/LICENSE @@ -0,0 +1,46 @@ +Copyright (c) 2024 Teo, Inc. (Celest) + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation and/or +other materials provided with the distribution. + +Subject to the terms and conditions of this license, each copyright holder and +contributor hereby grants to those receiving rights under this license a +perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable +(except for failure to satisfy the conditions of this license) patent license to +make, have made, use, offer to sell, sell, import, and otherwise transfer this +software, where such license applies only to those patent claims, already +acquired or hereafter acquired, licensable by such copyright holder or +contributor that are necessarily infringed by: + +(a) their Contribution(s) (the licensed copyrights of copyright holders and +non-copyrightable additions of contributors, in source or binary form) alone; or + +(b) combination of their Contribution(s) with the work of authorship to which +such Contribution(s) was added by such copyright holder or contributor, if, at +the time the Contribution is added, such addition causes such combination to be +necessarily infringed. The patent license shall not apply to any other +combinations which include the Contribution. + +Except as expressly stated above, no rights or licenses from any copyright +holder or contributor is granted under this license, whether expressly, by +implication, estoppel or otherwise. + +DISCLAIMER + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/services/celest_cloud_auth/README.md b/services/celest_cloud_auth/README.md index e695d9de..e457ad77 100644 --- a/services/celest_cloud_auth/README.md +++ b/services/celest_cloud_auth/README.md @@ -1,49 +1,52 @@ -A server app built using [Shelf](https://pub.dev/packages/shelf), -configured to enable running with [Docker](https://www.docker.com/). +# Celest Cloud Auth -This sample code handles HTTP GET requests to `/` and `/echo/` +A fully Dart-native solution for authenticating users and authorizing access to resources. Built on the [Cedar](https://www.cedarpolicy.com/en) policy engine and Celest Data. -# Running the sample +## Features -## Running with the Dart SDK +- **Authentication**: Securely authenticate users using email OTP, with support for passwordless and social logins coming soon. +- **Authorization**: Define and enforce access control policies using the [Cedar](https://www.cedarpolicy.com/en) policy engine. +- **Data**: Store user data and access control policies in SQLite or Celest Data. -You can run the example with the [Dart SDK](https://dart.dev/get-dart) -like this: +## Getting Started -``` -$ dart run bin/server.dart -Server listening on port 8080 -``` +The easiest way to get started with Celest Cloud Auth is to use the [Celest CLI](https://celest.dev/docs/get-started) and add an [AuthProvider](https://pub.dev/documentation/celest/latest/celest/AuthProvider-class.html) to your project. -And then from a second terminal: -``` -$ curl http://0.0.0.0:8080 -Hello, World! -$ curl http://0.0.0.0:8080/echo/I_love_Dart -I_love_Dart +```dart +import 'package:celest/celest.dart'; + +const project = Project(name: 'my-project'); + +const auth = Auth( + providers: [ + AuthProvider.email(), + ], +); ``` -## Running with Docker +Celest will automatically generate the necessary code to integrate Celest Cloud Auth into your project so you can start +authenticating users and controlling the resources they can access. -If you have [Docker Desktop](https://www.docker.com/get-started) installed, you -can build and run with the `docker` command: +Celest Cloud Auth can also be integrated into and Dart server, though, using the [shelf](https://pub.dev/packages/shelf) package. -``` -$ docker build . -t myserver -$ docker run -it -p 8080:8080 myserver -Server listening on port 8080 -``` +```dart +Future main() async { + final auth = await CelestCloudAuth.create( + database: AuthDatabase.memory(), + ); -And then from a second terminal: -``` -$ curl http://0.0.0.0:8080 -Hello, World! -$ curl http://0.0.0.0:8080/echo/I_love_Dart -I_love_Dart -``` + // Adds authentication routes. + final router = Router(); + router.mount('/v1alpha1/auth/', auth.handler); -You should see the logging printed in the first terminal: -``` -2021-05-06T15:47:04.620417 0:00:00.000158 GET [200] / -2021-05-06T15:47:08.392928 0:00:00.001216 GET [200] /echo/I_love_Dart + // Adds authorization middleware. + final pipeline = const Pipeline().addMiddleware(auth.middleware); + + final server = await serve( + pipeline.addHandler(router.call), + InternetAddress.anyIpV4, + 8080, + ); + print('Serving at http://${server.address.host}:${server.port}'); +} ``` diff --git a/services/celest_cloud_auth/bin/server.dart b/services/celest_cloud_auth/bin/server.dart index 87e8f26f..e090e135 100644 --- a/services/celest_cloud_auth/bin/server.dart +++ b/services/celest_cloud_auth/bin/server.dart @@ -24,7 +24,7 @@ void main(List args) async { // Configure a pipeline that logs requests. final handler = - Pipeline().addMiddleware(logRequests()).addHandler(_router.call); + const Pipeline().addMiddleware(logRequests()).addHandler(_router.call); // For running in containers, we respect the PORT environment variable. final port = int.parse(Platform.environment['PORT'] ?? '8080'); diff --git a/services/celest_cloud_auth/lib/src/authorization/policy_set.g.dart b/services/celest_cloud_auth/lib/src/authorization/policy_set.g.dart index 25be3684..968e5b93 100644 --- a/services/celest_cloud_auth/lib/src/authorization/policy_set.g.dart +++ b/services/celest_cloud_auth/lib/src/authorization/policy_set.g.dart @@ -4,7 +4,7 @@ library; import 'package:cedar/cedar.dart'; /// The core policy set. -/// +/// /// Included policies: /// - policies.cedar final corePolicySet = PolicySet.parse(corePolicySetCedar); diff --git a/services/celest_cloud_auth/lib/src/database/schema/converters/auth_converters.dart b/services/celest_cloud_auth/lib/src/database/schema/converters/auth_converters.dart index d48aaeba..6c51b3b2 100644 --- a/services/celest_cloud_auth/lib/src/database/schema/converters/auth_converters.dart +++ b/services/celest_cloud_auth/lib/src/database/schema/converters/auth_converters.dart @@ -1,5 +1,5 @@ -import 'package:celest_cloud_auth/src/authentication/authentication_model.dart'; import 'package:celest_cloud/src/proto.dart' as pb; +import 'package:celest_cloud_auth/src/authentication/authentication_model.dart'; import 'package:drift/drift.dart'; import 'package:protobuf/protobuf.dart'; diff --git a/services/celest_cloud_auth/lib/src/users/users_service.dart b/services/celest_cloud_auth/lib/src/users/users_service.dart index 11f70c05..11ffbc6e 100644 --- a/services/celest_cloud_auth/lib/src/users/users_service.dart +++ b/services/celest_cloud_auth/lib/src/users/users_service.dart @@ -3,6 +3,7 @@ import 'package:cedar/cedar.dart' hide Value; // ignore: invalid_use_of_internal_member import 'package:celest/src/runtime/http/cloud_middleware.dart'; import 'package:celest_ast/celest_ast.dart' hide Variable; +import 'package:celest_cloud/src/proto.dart' as pb; import 'package:celest_cloud_auth/src/authorization/authorization_middleware.dart'; import 'package:celest_cloud_auth/src/authorization/authorizer.dart'; import 'package:celest_cloud_auth/src/authorization/celest_action.dart'; @@ -15,7 +16,6 @@ import 'package:celest_cloud_auth/src/model/interop.dart'; import 'package:celest_cloud_auth/src/model/order_by.dart'; import 'package:celest_cloud_auth/src/model/page_token.dart'; import 'package:celest_cloud_auth/src/model/route_map.dart'; -import 'package:celest_cloud/src/proto.dart' as pb; import 'package:celest_core/celest_core.dart'; import 'package:drift/drift.dart' as drift; import 'package:drift/drift.dart'; diff --git a/services/celest_cloud_auth/pubspec.yaml b/services/celest_cloud_auth/pubspec.yaml index 0b75e26e..8ab70cea 100644 --- a/services/celest_cloud_auth/pubspec.yaml +++ b/services/celest_cloud_auth/pubspec.yaml @@ -1,5 +1,5 @@ name: celest_cloud_auth -description: The Celest authentication and authorization service. +description: A Dart-native authentication and authorization service built on Celest, Cedar, and SQLite. version: 0.1.0 environment: @@ -9,10 +9,10 @@ dependencies: args: ^2.4.0 async: ^2.11.0 cedar: ^0.2.2 - celest: ^1.0.0-0 + celest: ^1.0.0 celest_ast: ^0.1.0 celest_cloud: ^0.1.0 - celest_core: ^1.0.0-0 + celest_core: ^1.0.0 clock: ^1.1.1 collection: ^1.18.0 convert: ^3.1.1 diff --git a/services/celest_cloud_auth/tool/render_email.dart b/services/celest_cloud_auth/tool/render_email.dart index 9bad3b0d..04006952 100644 --- a/services/celest_cloud_auth/tool/render_email.dart +++ b/services/celest_cloud_auth/tool/render_email.dart @@ -43,7 +43,7 @@ Future _handleRequests(HttpServer server) async { final templates = { 'VerificationCode': ( - VerificationCodeEmail(), + const VerificationCodeEmail(), const VerificationCodeEmailParams( email: 'test@celest.dev', code: '123456',