Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Recreate firebase user on password reset #685

Closed
wants to merge 19 commits into from

Conversation

whaught
Copy link
Contributor

@whaught whaught commented Sep 25, 2020

Proposed Changes

  • When resetting password, ensure that if we have a db.User that we also have a firebase user
  • Move password-reset to server-side for Users/ page

Release Note

Ensure that password-reset flows also check that the firebase user auth is created if it's missing and we have an entry for the user.

@google-oss-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: whaught

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@googlebot googlebot added the cla: yes Auto: added by CLA bot when all committers have signed a CLA. label Sep 25, 2020
@whaught whaught changed the title [WIP] Recreate firebase user on password reset\ [WIP] Recreate firebase user on password reset Sep 25, 2020
@whaught whaught changed the title [WIP] Recreate firebase user on password reset Recreate firebase user on password reset Sep 25, 2020
cmd/server/main.go Outdated Show resolved Hide resolved
FirebaseRecreates *stats.Int64Measure
}

func MetricsFromContext(ctx context.Context) (context.Context, *Metrics, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't love the dependency through context - it now implies an ordering between controller creation.

I still think there are other solutions that don't require that ordering / dependency

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by ordering? This is lazily initialized as a singleton on context, if the controller can't find it on context, it gets created. Controllers can be organized in any order (the first one will create)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it requires that everyone who calls it shares a context though, otherwise it will be created twice.

that may be OK in opencensus - I'm not positive

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think OC actually requires you to use the ctx - all the data is stored on the ctx

@whaught
Copy link
Contributor Author

whaught commented Oct 2, 2020

/close

I'm going to reconsider this. Not sure if we want to do this on the external login server-side - maybe we sneak this metric in the db layer to avoid mike's context-sharing concerns

@@ -219,62 +219,64 @@ func realMain(ctx context.Context) error {
sub.Handle("/health", controller.HandleHealthz(ctx, &cfg.Database, h)).Methods("GET")
}

ctx, loginController, err := login.New(ctx, firebaseInternal, auth, cfg, db, h)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this diff so large?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was because we were sharing context.Context so this line was unindented (to be scoped so that ctx could be shared across controllers. This has been reverted

FirebaseRecreates *stats.Int64Measure
}

func MetricsFromContext(ctx context.Context) (context.Context, *Metrics, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm gonna defer to @yegle and @icco here on the best practice

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed all that and shoved it into the database per our conversation. I think sharing context makes sense but @mikehelmick prefers the tighter scoping in main.go

@whaught
Copy link
Contributor Author

whaught commented Oct 5, 2020

/retest

@google-oss-robot
Copy link

@whaught: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-en-server-release-unit 44fc5d5 link /test pull-en-server-release-unit

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@whaught
Copy link
Contributor Author

whaught commented Oct 6, 2020

/close

This has been replaced

@google-oss-robot
Copy link

@whaught: Closed this PR.

In response to this:

/close

This has been replaced

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@whaught whaught deleted the recreate-user branch October 6, 2020 21:41
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes Auto: added by CLA bot when all committers have signed a CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants