Skip to content
This repository has been archived by the owner on Mar 8, 2022. It is now read-only.

Add support for custom sms gateway #417

Merged
merged 3 commits into from Jan 25, 2022

Conversation

grese
Copy link

@grese grese commented Jul 22, 2021

Proposed Changes

Added support for custom sms gateway to the auth0_connection resource as described in #416. The process for setting up a custom SMS gateway is described in this auth0 post.

NOTE: This PR relies on go-auth0/auth0 #230.

  • Added provider to auth0_connection resource (to specify a custom sms provider such as "sms_gateway")
  • Added gateway_url to auth0_connection resource (for the url for the sms gateway)
  • Added gateway_authentication block to auth0_connection resource (settings for the HS256 token sent to sms gateway). The block supports...
    • method (authentication method for the custom gateway - e.g. "bearer")
    • subject (subject claim for the token sent to custom gateway)
    • audience (audience claim for the token sent to custom gateway)
    • secret (secret used to sign the token sent to custom gateway)
    • secret_base64_encoded (specifies whether or not the secret is base64 encoded)
  • Added forward_request_info to auth0_connection resource (specifies that request info such as ip and user-agent should be forwarded to the sms gateway)

Terraform Configuration

resource "auth0_connection" "custom_sms_connection" {
  name     = "sms"
  strategy = "sms"
  ...
  options {
    provider    = "sms_gateway"
    gateway_url = "https://test.com/sms-gateway"
    gateway_authentication {
      method                = "bearer"
      subject               = "test.us.auth0.com:sms"
      audience              = "https://test.com/sms-gateway"
      secret                = "<My Shared Secret>"
      secret_base64_encoded = false
    }
    forward_request_info = true
    ...
  }
}

Acceptance Test Output

=== RUN   TestAccConnection
--- PASS: TestAccConnection (3.91s)
=== RUN   TestAccConnectionAD
--- PASS: TestAccConnectionAD (2.47s)
=== RUN   TestAccConnectionAzureAD
--- PASS: TestAccConnectionAzureAD (3.38s)
=== RUN   TestAccConnectionOIDC
--- PASS: TestAccConnectionOIDC (3.33s)
=== RUN   TestAccConnectionOAuth2
--- PASS: TestAccConnectionOAuth2 (10.12s)
=== RUN   TestAccConnectionWithEnbledClients
--- PASS: TestAccConnectionWithEnbledClients (10.46s)
=== RUN   TestAccConnectionSMS
--- PASS: TestAccConnectionSMS (2.29s)
=== RUN   TestAccConnectionCustomSMS
--- PASS: TestAccConnectionCustomSMS (2.58s)
=== RUN   TestAccConnectionEmail
--- PASS: TestAccConnectionEmail (9.80s)
=== RUN   TestAccConnectionSalesforce
--- PASS: TestAccConnectionSalesforce (1.98s)
=== RUN   TestAccConnectionGoogleOAuth2
--- PASS: TestAccConnectionGoogleOAuth2 (1.83s)
=== RUN   TestAccConnectionFacebook
--- PASS: TestAccConnectionFacebook (3.18s)
=== RUN   TestAccConnectionApple
--- PASS: TestAccConnectionApple (3.10s)
=== RUN   TestAccConnectionLinkedin
--- PASS: TestAccConnectionLinkedin (9.87s)
=== RUN   TestAccConnectionGitHub
--- PASS: TestAccConnectionGitHub (2.13s)
=== RUN   TestAccConnectionWindowslive
--- PASS: TestAccConnectionWindowslive (3.84s)
=== RUN   TestAccConnectionConfiguration
--- PASS: TestAccConnectionConfiguration (5.25s)
=== RUN   TestConnectionInstanceStateUpgradeV0
=== RUN   TestConnectionInstanceStateUpgradeV0/Empty
=== RUN   TestConnectionInstanceStateUpgradeV0/Zero
=== RUN   TestConnectionInstanceStateUpgradeV0/NonZero
=== RUN   TestConnectionInstanceStateUpgradeV0/Invalid
--- PASS: TestConnectionInstanceStateUpgradeV0 (0.00s)
    --- PASS: TestConnectionInstanceStateUpgradeV0/Empty (0.00s)
    --- PASS: TestConnectionInstanceStateUpgradeV0/Zero (0.00s)
    --- PASS: TestConnectionInstanceStateUpgradeV0/NonZero (0.00s)
    --- PASS: TestConnectionInstanceStateUpgradeV0/Invalid (0.00s)
=== RUN   TestConnectionInstanceStateUpgradeV1
=== RUN   TestConnectionInstanceStateUpgradeV1/Only_Min
=== RUN   TestConnectionInstanceStateUpgradeV1/Min_and_Max
--- PASS: TestConnectionInstanceStateUpgradeV1 (0.00s)
    --- PASS: TestConnectionInstanceStateUpgradeV1/Only_Min (0.00s)
    --- PASS: TestConnectionInstanceStateUpgradeV1/Min_and_Max (0.00s)
=== RUN   TestAccConnectionSAML
--- PASS: TestAccConnectionSAML (3.67s)

Community Note

  • Please vote on this pull request by adding a 馃憤 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

Copy link
Collaborator

@willvedd willvedd left a comment

Choose a reason for hiding this comment

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

Solid work. I manually verified that this functions as well as confirmed that it passes tests. Also added an example snippet in the docs.

Copy link
Collaborator

@sergiught sergiught left a comment

Choose a reason for hiding this comment

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

馃憤馃徎

@willvedd willvedd merged commit 690e7f2 into alexkappa:master Jan 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants