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

Commit

Permalink
Merge pull request #13 from hypnoglow/add-requires-username
Browse files Browse the repository at this point in the history
Add requires_username option to auth0 connection
  • Loading branch information
alexkappa authored Aug 16, 2018
2 parents 2899762 + 9b526a1 commit 14dfd41
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion management/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type ConnectionOptions struct {
BruteForceProtection bool `json:"brute_force_protection,omitempty"`
ImportMode bool `json:"import_mode,omitempty"`
DisableSignup bool `json:"disable_signup,omitempty"`
RequiresUsername bool `json:"requires_username,omitempty"`

// Options for adding parameters in the request to the upstream IdP.
UpstreamParams interface{} `json:"upstream_params,omitempty"`
Expand All @@ -90,7 +91,6 @@ type ConnectionOptions struct {
CustomScripts map[string]interface{} `json:"custom_scripts,omitempty"`
// configuration variables that can be used in custom scripts
Configuration map[string]interface{} `json:"configuration,omitempty"`

}

type ConnectionManager struct {
Expand Down
9 changes: 7 additions & 2 deletions management/connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ func TestConnection(t *testing.T) {
c.Name = "" // read-only
c.Strategy = "" // read-only
c.Options = &ConnectionOptions{
CustomScripts: map[string]interface{}{"get_user": "function(email, callback) { return callback(null) }"},
Configuration: map[string]interface{}{"foo": "bar"},
CustomScripts: map[string]interface{}{"get_user": "function(email, callback) { return callback(null) }"},
Configuration: map[string]interface{}{"foo": "bar"},
RequiresUsername: true,
}

cc := c // make a copy so we can compare later
Expand All @@ -56,6 +57,10 @@ func TestConnection(t *testing.T) {
if _, exist := c.Options.Configuration["foo"]; !exist {
t.Fatal(`missing key "foo"`)
}

if c.Options.RequiresUsername != cc.Options.RequiresUsername {
t.Fatalf("expected requires_username to be %v but got %v", cc.Options.RequiresUsername, c.Options.RequiresUsername)
}
})

t.Run("Delete", func(t *testing.T) {
Expand Down

0 comments on commit 14dfd41

Please sign in to comment.