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 support for APNS and FCM endpoints for Direct mode Guardian #184

Merged
merged 4 commits into from
Mar 16, 2023

Conversation

lochiiconnectivity
Copy link
Contributor

🔧 Changes

Add support for customising APNS and FCM on the Guardian (push) direct provider, supporting the following endpoints:

This is to support configuration of the direct provider.

📚 References

auth0/terraform-provider-auth0#535 (comment)

🔬 Testing

  • for APNS, Setting Sandbox mode, BundleID and P12 is supported. P12 must be provided as a Base64 Encoded String. When retrieving APNS configuration, the P12 will not be returned, and will instead be replaced by an "enabled" flag. It is not possible to update this flag.

  • for FCM, Setting only ServerKey is supported, it is not possible to query FCM state.

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

@lochiiconnectivity lochiiconnectivity requested a review from a team as a code owner March 15, 2023 21:54
@codecov-commenter
Copy link

codecov-commenter commented Mar 16, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.02 🎉

Comparison is base (4b3d518) 94.88% compared to head (a4a2136) 94.91%.

❗ Current head a4a2136 differs from pull request most recent head a30aaee. Consider uploading reports for the commit a30aaee to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #184      +/-   ##
==========================================
+ Coverage   94.88%   94.91%   +0.02%     
==========================================
  Files          38       38              
  Lines        6810     6846      +36     
==========================================
+ Hits         6462     6498      +36     
  Misses        278      278              
  Partials       70       70              
Impacted Files Coverage Δ
management/guardian.go 93.66% <100.00%> (+0.32%) ⬆️
management/management.gen.go 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@ewanharris ewanharris left a comment

Choose a reason for hiding this comment

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

Other than the lint issue flagged in the tests this looks good. Thanks @lochiiconnectivity!

// as it is incompatible

// Read the p12 from file
expectedP12, err := ioutil.ReadFile("../test/data/apns.p12")
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure why it isn't been shown inline, but the linter is flagging the usage of ioutil.ReadFile here, asking to use os.ReadFile instead.

SA1019: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred in new code. See the specific function documentation for details.  (staticcheck)

Copy link
Contributor Author

@lochiiconnectivity lochiiconnectivity Mar 16, 2023

Choose a reason for hiding this comment

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

I opted to use io/ioutil, in keeping with the style of the current project and not introducing any new dependencies, as you can see, it's used by https://github.com/auth0/go-auth0/blob/main/management/gen-methods.go#L22 , and specifically called at https://github.com/auth0/go-auth0/blob/main/management/gen-methods.go#L198 , happy to change out to os.ReadFile if you wish

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah it will need to change if you can please in order to pass the linting. The gen-methods.go is ignored by the linter it seems, but I'll look to get that updated to keep it consistent.

Copy link
Contributor

@ewanharris ewanharris left a comment

Choose a reason for hiding this comment

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

Once again thanks for this change @lochiiconnectivity!

We wanted to regenerate the p12 file to ensure it was clean of any PII so I went ahead and fixed the ioutil warning and pushed that.

@ewanharris ewanharris merged commit 6c93200 into auth0:main Mar 16, 2023
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