Skip to content

Commit

Permalink
User management connID and OrgID updates (#318)
Browse files Browse the repository at this point in the history
* user management connID and OrgID updates

* updadating "TestClientAuthorizeURL" func
  • Loading branch information
rarevalo13 authored Apr 4, 2024
1 parent 33561c2 commit 97b3556
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pkg/usermanagement/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -741,10 +741,10 @@ func (c *Client) GetAuthorizationURL(opts GetAuthorizationURLOpts) (*url.URL, er
query.Set("provider", string(opts.Provider))
}
if opts.ConnectionID != "" {
query.Set("connection", opts.ConnectionID)
query.Set("connection_id", opts.ConnectionID)
}
if opts.OrganizationID != "" {
query.Set("organization", opts.OrganizationID)
query.Set("organization_id", opts.OrganizationID)
}
if opts.LoginHint != "" {
query.Set("login_hint", opts.LoginHint)
Expand Down
10 changes: 5 additions & 5 deletions pkg/usermanagement/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ func TestClientAuthorizeURL(t *testing.T) {
RedirectURI: "https://example.com/sso/workos/callback",
State: "custom state",
},
expected: "https://api.workos.com/user_management/authorize?client_id=client_123&connection=connection_123&redirect_uri=https%3A%2F%2Fexample.com%2Fsso%2Fworkos%2Fcallback&response_type=code&state=custom+state",
expected: "https://api.workos.com/user_management/authorize?client_id=client_123&connection_id=connection_123&redirect_uri=https%3A%2F%2Fexample.com%2Fsso%2Fworkos%2Fcallback&response_type=code&state=custom+state",
},
{
scenario: "generate url with state",
Expand All @@ -564,7 +564,7 @@ func TestClientAuthorizeURL(t *testing.T) {
RedirectURI: "https://example.com/sso/workos/callback",
State: "custom state",
},
expected: "https://api.workos.com/user_management/authorize?client_id=client_123&connection=connection_123&provider=GoogleOAuth&redirect_uri=https%3A%2F%2Fexample.com%2Fsso%2Fworkos%2Fcallback&response_type=code&state=custom+state",
expected: "https://api.workos.com/user_management/authorize?client_id=client_123&connection_id=connection_123&provider=GoogleOAuth&redirect_uri=https%3A%2F%2Fexample.com%2Fsso%2Fworkos%2Fcallback&response_type=code&state=custom+state",
},
{
scenario: "generate url with organization",
Expand All @@ -574,7 +574,7 @@ func TestClientAuthorizeURL(t *testing.T) {
RedirectURI: "https://example.com/sso/workos/callback",
State: "custom state",
},
expected: "https://api.workos.com/user_management/authorize?client_id=client_123&organization=organization_123&redirect_uri=https%3A%2F%2Fexample.com%2Fsso%2Fworkos%2Fcallback&response_type=code&state=custom+state",
expected: "https://api.workos.com/user_management/authorize?client_id=client_123&organization_id=organization_123&redirect_uri=https%3A%2F%2Fexample.com%2Fsso%2Fworkos%2Fcallback&response_type=code&state=custom+state",
},
{
scenario: "generate url with DomainHint",
Expand All @@ -585,7 +585,7 @@ func TestClientAuthorizeURL(t *testing.T) {
State: "custom state",
DomainHint: "foo.com",
},
expected: "https://api.workos.com/user_management/authorize?client_id=client_123&connection=connection_123&domain_hint=foo.com&redirect_uri=https%3A%2F%2Fexample.com%2Fsso%2Fworkos%2Fcallback&response_type=code&state=custom+state",
expected: "https://api.workos.com/user_management/authorize?client_id=client_123&connection_id=connection_123&domain_hint=foo.com&redirect_uri=https%3A%2F%2Fexample.com%2Fsso%2Fworkos%2Fcallback&response_type=code&state=custom+state",
},
{
scenario: "generate url with LoginHint",
Expand All @@ -596,7 +596,7 @@ func TestClientAuthorizeURL(t *testing.T) {
State: "custom state",
LoginHint: "[email protected]",
},
expected: "https://api.workos.com/user_management/authorize?client_id=client_123&connection=connection_123&login_hint=foo%40workos.com&redirect_uri=https%3A%2F%2Fexample.com%2Fsso%2Fworkos%2Fcallback&response_type=code&state=custom+state",
expected: "https://api.workos.com/user_management/authorize?client_id=client_123&connection_id=connection_123&login_hint=foo%40workos.com&redirect_uri=https%3A%2F%2Fexample.com%2Fsso%2Fworkos%2Fcallback&response_type=code&state=custom+state",
},
}

Expand Down

0 comments on commit 97b3556

Please sign in to comment.