Skip to content
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

Add self-service Bootstrap OTP generation. #68

Merged
merged 7 commits into from
Jul 9, 2020

Conversation

rgooch
Copy link
Member

@rgooch rgooch commented Jun 12, 2020

No description provided.

@rgooch rgooch requested a review from cviecco June 12, 2020 14:55
state.logger.Printf("error generating Bootstrap OTP: %s", err)
return
}
duration := time.Minute * 5
Copy link
Contributor

Choose a reason for hiding this comment

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

make this a const

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@@ -111,6 +111,44 @@ func (state *RuntimeState) BootstrapOtpAuthHandler(w http.ResponseWriter,
}
}

func (state *RuntimeState) trySelfServiceGenerateBootstrapOTP(username string,
Copy link
Contributor

Choose a reason for hiding this comment

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

I dont like the signature of this function, it should return a bool if successful, otherwise we cannot distingusish sucess from failure... and thus as it is right now there is a race condition where the otp generated but fails to be added to the DB.

Thus on the caller you can do
selfServiceOtpGenerated := state.trySelfServiceGenerateBootstrapOTP.....

I really dislike logic where updates to object are not explicitly communicated.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've changed the function signature. The caller hasn't changed because there isn't really anything it would do differently regardless of the return status.

@cviecco cviecco merged commit 47d18c3 into Cloud-Foundations:master Jul 9, 2020
@rgooch rgooch deleted the self-service-bootstrap branch February 14, 2021 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants