-
Notifications
You must be signed in to change notification settings - Fork 217
Blocking-fn-sms-final #1589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
pragatimodi
wants to merge
6
commits into
firebase:blidd.blocking-fn-email-final
Choose a base branch
from
pragatimodi:blocking-fn-sms-final
base: blidd.blocking-fn-email-final
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Blocking-fn-sms-final #1589
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
161c37c
Add beforeSmsSent blocking functions trigger
pragatimodi 6bc1c6b
adding spec.ts changes
pragatimodi 6b4e59d
lint
pragatimodi 5f77c8b
add missing tests
pragatimodi 24e2803
lint
pragatimodi da30675
changelog
pragatimodi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
- Add support for beforeEmailSent auth blocking triggers. (#1492) | ||
- Add support for beforeSmsSent auth blocking triggers. (#1589) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -529,6 +529,7 @@ describe("identity", () => { | |
eventId: "EVENT_ID", | ||
eventType: EVENT, | ||
emailType: undefined, | ||
smsType: undefined, | ||
authType: "UNAUTHENTICATED", | ||
resource: { | ||
service: "identitytoolkit.googleapis.com", | ||
|
@@ -542,6 +543,7 @@ describe("identity", () => { | |
isNewUser: false, | ||
recaptchaScore: TEST_RECAPTCHA_SCORE, | ||
email: undefined, | ||
phoneNumber: undefined, | ||
}, | ||
credential: null, | ||
params: {}, | ||
|
@@ -580,6 +582,7 @@ describe("identity", () => { | |
eventId: "EVENT_ID", | ||
eventType: "providers/cloud.auth/eventTypes/user.beforeSignIn:password", | ||
emailType: undefined, | ||
smsType: undefined, | ||
authType: "UNAUTHENTICATED", | ||
resource: { | ||
service: "identitytoolkit.googleapis.com", | ||
|
@@ -593,6 +596,7 @@ describe("identity", () => { | |
isNewUser: false, | ||
recaptchaScore: TEST_RECAPTCHA_SCORE, | ||
email: undefined, | ||
phoneNumber: undefined, | ||
}, | ||
credential: { | ||
claims: undefined, | ||
|
@@ -668,6 +672,7 @@ describe("identity", () => { | |
eventId: "EVENT_ID", | ||
eventType: "providers/cloud.auth/eventTypes/user.beforeCreate:oidc.provider", | ||
emailType: undefined, | ||
smsType: undefined, | ||
authType: "USER", | ||
resource: { | ||
service: "identitytoolkit.googleapis.com", | ||
|
@@ -681,6 +686,7 @@ describe("identity", () => { | |
isNewUser: true, | ||
recaptchaScore: TEST_RECAPTCHA_SCORE, | ||
email: undefined, | ||
phoneNumber: undefined, | ||
}, | ||
credential: { | ||
claims: undefined, | ||
|
@@ -721,6 +727,7 @@ describe("identity", () => { | |
eventId: "EVENT_ID", | ||
eventType: "providers/cloud.auth/eventTypes/user.beforeSendEmail", | ||
emailType: "RESET_PASSWORD", | ||
smsType: undefined, | ||
authType: "UNAUTHENTICATED", | ||
resource: { | ||
service: "identitytoolkit.googleapis.com", | ||
|
@@ -734,6 +741,53 @@ describe("identity", () => { | |
username: undefined, | ||
recaptchaScore: TEST_RECAPTCHA_SCORE, | ||
email: "[email protected]", | ||
phoneNumber: undefined, | ||
}, | ||
credential: null, | ||
params: {}, | ||
}; | ||
|
||
expect(identity.parseAuthEventContext(decodedJwt, "project-id", time)).to.deep.equal(context); | ||
}); | ||
|
||
it("should parse a beforeSendSms event", () => { | ||
const time = now.getTime(); | ||
const decodedJwt = { | ||
iss: "https://securetoken.google.com/project_id", | ||
aud: "https://us-east1-project_id.cloudfunctions.net/function-1", | ||
iat: 1, | ||
exp: 60 * 60 + 1, | ||
event_id: "EVENT_ID", | ||
event_type: "beforeSendSms", | ||
user_agent: "USER_AGENT", | ||
ip_address: "1.2.3.4", | ||
locale: "en", | ||
recaptcha_score: TEST_RECAPTCHA_SCORE, | ||
sms_type: "SIGN_IN_OR_SIGN_UP", | ||
phone_number: "+11234567890", | ||
}; | ||
const context = { | ||
locale: "en", | ||
ipAddress: "1.2.3.4", | ||
userAgent: "USER_AGENT", | ||
eventId: "EVENT_ID", | ||
eventType: "providers/cloud.auth/eventTypes/user.beforeSendSms", | ||
emailType: undefined, | ||
smsType: "SIGN_IN_OR_SIGN_UP", | ||
authType: "UNAUTHENTICATED", | ||
resource: { | ||
service: "identitytoolkit.googleapis.com", | ||
name: "projects/project-id", | ||
}, | ||
timestamp: new Date(1000).toUTCString(), | ||
additionalUserInfo: { | ||
isNewUser: false, | ||
profile: undefined, | ||
providerId: undefined, | ||
username: undefined, | ||
recaptchaScore: TEST_RECAPTCHA_SCORE, | ||
email: undefined, | ||
phoneNumber: "+11234567890", | ||
}, | ||
credential: null, | ||
params: {}, | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can maybe merge these 2 change log together since they will be merged to master together.