Skip to content

Commit 0cda1a6

Browse files
committed
refactor: move internals for identity to private module
1 parent e751399 commit 0cda1a6

File tree

5 files changed

+425
-339
lines changed

5 files changed

+425
-339
lines changed

Diff for: β€Ž.pylintrc

+1
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ disable=abstract-method,
146146
wrong-import-order,
147147
xrange-builtin,
148148
zip-builtin-not-iterating,
149+
import-outside-toplevel,
149150

150151

151152
[REPORTS]

Diff for: β€Ždocs/generate.sh

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ PY_MODULES='firebase_functions
8686
firebase_functions.core
8787
firebase_functions.db_fn
8888
firebase_functions.https_fn
89+
firebase_functions.identity_fn
8990
firebase_functions.options
9091
firebase_functions.params
9192
firebase_functions.pubsub_fn

Diff for: β€Žsamples/identity/functions/main.py

+23-8
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@ def beforeusercreated(
1414
if not event.data.email:
1515
return None
1616
if "@cats.com" in event.data.email:
17-
return identity_fn.BeforeCreateResponse(display_name="🐈",
18-
custom_claims={"meow": True})
17+
return identity_fn.BeforeCreateResponse(
18+
display_name="🐈",
19+
custom_claims={"meow": True},
20+
)
1921
if "@dogs.com" in event.data.email:
20-
return identity_fn.BeforeCreateResponse(display_name="πŸ•",
21-
custom_claims={"woof": True})
22+
return identity_fn.BeforeCreateResponse(
23+
display_name="πŸ•",
24+
custom_claims={"woof": True},
25+
)
2226
return None
2327

2428

@@ -33,10 +37,21 @@ def beforeusersignedin(
3337
print(event)
3438
if not event.data.email:
3539
return None
40+
3641
if "@cats.com" in event.data.email:
37-
return identity_fn.BeforeSignInResponse(
38-
display_name="🐈", session_claims={"temporary_meow": True})
42+
return {
43+
"display_name": "🐈",
44+
"session_claims": {
45+
"session_meow": True
46+
},
47+
}
48+
3949
if "@dogs.com" in event.data.email:
40-
return identity_fn.BeforeSignInResponse(
41-
display_name="πŸ•", session_claims={"temporary_woof": True})
50+
return {
51+
"display_name": "πŸ•",
52+
"session_claims": {
53+
"session_woof": True
54+
},
55+
}
56+
4257
return None

0 commit comments

Comments
Β (0)