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

IDS-4410 - Add org. connection hiding support #889

Merged
merged 5 commits into from
Feb 8, 2024

Conversation

ubenzer
Copy link
Contributor

@ubenzer ubenzer commented Feb 7, 2024

🔧 Changes

Adds support for organization level connection hiding.

📚 References

IDS-4410

🔬 Testing

Create a config.json file similar to:

{
    "AUTH0_DOMAIN": "XYZ.auth0.com",
    "AUTH0_CLIENT_ID": "AAA",
    "AUTH0_CLIENT_SECRET": "BBB",
    "AUTH0_INCLUDED_ONLY": ["organizations"],
    "AUTH0_ALLOW_DELETE": false
  }

and run

node lib/index.js export -c config.json -o ./local -f yaml
node lib/index.js import -c config.json --input_file ./local/tenant.yaml

with different combinations to test:

  1. show_as_button is exported.
  2. show_as_button is imported on creation.
  3. show_as_button changes to existing enabled connections are detected and it is updated.

Do the same test or json format as well.

📝 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) N/A

@ubenzer ubenzer requested a review from a team as a code owner February 7, 2024 11:51
Copy link
Contributor

@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.

@ubenzer Can you do a final verification that out-of-band changes are handled appropriately? Once that verification is done, I think this is good to go 👍

Comment on lines +130 to +131
(x.assign_membership_on_login !== c.assign_membership_on_login ||
x.show_as_button !== c.show_as_button)
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 if the code added and the existing code here makes sense. This is trying to match existing connections with connections that are in the config. Not sure why we want to consider anything other than the ID when performing this filter.

One way to test this is to make an out-of-band change in the UI or API and then try to make an update to a particular organization connection with the Deploy CLI.

Update: Looking again, this might be ok because it assures that you're only making an API request for connections that have updated either property. This is normally unnecessary because the API is idempotent but we can keep because at least there won't be a regression.

Comment on lines +141 to +144
{
assign_membership_on_login: conn.assign_membership_on_login,
show_as_button: conn.show_as_button,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This should work and is perfectly fine if we have a small number of properties being included in the payload.

However if this payload grows in the future, we may consider passing-in the entire conn object (w/o ID) so that future properties added can be managed by default. There are tradeoffs for this of course, if there is some type of breaking functionality, but just something to consider.

@@ -36,7 +36,7 @@ describe('#context loader validation', async () => {
delete tmpConfig.AUTH0_ACCESS_TOKEN;
});

it('should error while attempting authentication, but pass validation with client secret', async () => {
it.skip('should error while attempting authentication, but pass validation with client secret', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Either one of dependencies were updated or the Auth API changed and cause this test to time-out rather than to provide an access_denied error. Or at least in the context of this repo. For the sake of time and getting this feature in, I'm opting to skip.

Comment on lines -325 to -338
addEnabledConnection: (params, data) => {
expect(params).to.be.an('object');
expect(params.id).to.equal('123');
expect(data).to.be.an('object');
expect(data.connection_id).to.equal('con_789');
expect(data.assign_membership_on_login).to.equal(false);
return Promise.resolve(data);
},
removeEnabledConnection: (params) => {
expect(params).to.be.an('object');
expect(params.id).to.equal('123');
expect(params.connection_id).to.equal(sampleEnabledConnection2.connection_id);
return Promise.resolve();
},
Copy link
Contributor

Choose a reason for hiding this comment

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

No-op; not necessary.

Copy link

@nkavtur nkavtur left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@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.

Tests aren't passing because this is a fork but I've confirmed myself that they pass.

Looks good, thanks for the contribution!

@willvedd willvedd merged commit 04bfe0b into auth0:master Feb 8, 2024
6 of 7 checks passed
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