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

Adding auth_params for passwordless email connections (1/3) #235

Merged
merged 14 commits into from
Jul 15, 2022

Conversation

willvedd
Copy link
Contributor

@willvedd willvedd commented Jul 12, 2022

Description

As requested by #31 , this PR introduces the ability to manage authentication params for passwordless email connections. These are key-value properties that override or append to the query params of OTP links via email. One important deviation from the original request is the intentional decision to only add for passwordless email connections. I could not support the claim that that field existing for passwordless SMS connections too.

Checklist

Note: Checklist required to be completed before a PR is considered to be reviewable.

Auth0 Code of Conduct

Auth0 General Contribution Guidelines

Changes include test coverage?

  • Yes
  • Not needed

Does the description provide the correct amount of context?

  • Yes, the description provides enough context for the reviewer to understand what these changes accomplish

Have you updated the documentation?

  • Yes, I've updated the appropriate docs
  • Not needed

Is this code ready for production?

  • Yes, all code changes are intentional and no debugging calls are left over

@willvedd willvedd requested a review from a team as a code owner July 12, 2022 21:55
@codecov-commenter
Copy link

codecov-commenter commented Jul 12, 2022

Codecov Report

Merging #235 (288b353) into main (a8ad066) will decrease coverage by 0.01%.
The diff coverage is 70.00%.

@@            Coverage Diff             @@
##             main     #235      +/-   ##
==========================================
- Coverage   82.62%   82.60%   -0.02%     
==========================================
  Files          36       36              
  Lines        6842     6852      +10     
==========================================
+ Hits         5653     5660       +7     
- Misses        938      940       +2     
- Partials      251      252       +1     
Impacted Files Coverage Δ
auth0/resource_auth0_connection.go 71.33% <ø> (ø)
auth0/structure_auth0_connection.go 83.78% <70.00%> (-0.15%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a8ad066...288b353. Read the comment docs.

@@ -385,6 +386,13 @@ func flattenConnectionOptionsEmail(options *management.ConnectionOptionsEmail) (
}
m["upstream_params"] = upstreamParams

if options.AuthParams != nil {
v, ok := options.AuthParams.(map[string]string)
if ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to throw an error if auth params are not a map? Or at least a warning (using the diagnostics pkg)?

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 think throwing an error is a little heavy-handed here, but certainly agree that some action is necessary. I think logging a warning strikes a good balance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the warning. However, I'm unable to get it to render in the console, despite that LoC being reached and appropriate log verbosity configured.

Copy link
Contributor

Choose a reason for hiding this comment

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

To raise a warning you need to use a diagnostics message with SeverityWarning: https://github.com/hashicorp/terraform-plugin-sdk/blob/70ce77bce6118b74a49762bb401b46a723c0bab8/diag/diagnostic.go#L101. You can get inspiration from the hook resource:

func checkForUntrackedHookSecrets(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This logging is performed in this upstream PR: #241

auth0/structure_auth0_connection.go Outdated Show resolved Hide resolved
docs/resources/connection.md Outdated Show resolved Hide resolved
auth0/structure_auth0_connection.go Outdated Show resolved Hide resolved
@willvedd willvedd requested a review from sergiught July 13, 2022 20:09
@willvedd willvedd changed the title Adding auth_params for passwordless email connections Adding auth_params for passwordless email connections (1/3) Jul 14, 2022
sergiught
sergiught previously approved these changes Jul 15, 2022
@sergiught sergiught merged commit b4b760d into main Jul 15, 2022
@sergiught sergiught deleted the add-auth-params-passwordless-connections branch July 15, 2022 14:35
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.

3 participants