@cedarjs/auth-firebase-setup 8.0.0-canary.3384 → 8.0.0-canary.3387

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  import admin from 'firebase-admin'
2
2
 
3
+ import type { Decoded } from '@cedarjs/api'
3
4
  import { AuthenticationError } from '@cedarjs/graphql-server'
4
5
 
5
6
  // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
@@ -23,13 +24,7 @@ const adminApp = admin.initializeApp({
23
24
  *
24
25
  * @see https://github.com/cedarjs/cedar/tree/main/packages/auth for examples
25
26
  */
26
- export const getCurrentUser = async (
27
- decoded,
28
- /* eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars */
29
- { token, type },
30
- /* eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars */
31
- { event, context }
32
- ) => {
27
+ export const getCurrentUser = async (decoded: Decoded) => {
33
28
  return decoded
34
29
  }
35
30
 
@@ -52,7 +47,11 @@ export const isAuthenticated = (): boolean => {
52
47
  *
53
48
  * @see https://github.com/cedarjs/cedar/tree/main/packages/auth for examples
54
49
  */
55
- export const requireAuth = () => {
50
+ export const requireAuth = (
51
+ // The @requireAuth directive passes the roles it was given. Checking them
52
+ // needs a custom RBAC implementation, see below
53
+ _options: { roles?: string | string[] } = {}
54
+ ) => {
56
55
  if (!isAuthenticated()) {
57
56
  throw new AuthenticationError("You don't have permission to do that.")
58
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/auth-firebase-setup",
3
- "version": "8.0.0-canary.3384",
3
+ "version": "8.0.0-canary.3387",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cedarjs/cedar.git",
@@ -39,10 +39,10 @@
39
39
  "test:watch": "vitest watch"
40
40
  },
41
41
  "dependencies": {
42
- "@cedarjs/cli-helpers": "8.0.0-canary.3384"
42
+ "@cedarjs/cli-helpers": "8.0.0-canary.3387"
43
43
  },
44
44
  "devDependencies": {
45
- "@cedarjs/framework-tools": "8.0.0-canary.3384",
45
+ "@cedarjs/framework-tools": "8.0.0-canary.3387",
46
46
  "@types/yargs": "17.0.35",
47
47
  "concurrently": "9.2.4",
48
48
  "publint": "0.3.25",