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

Update MSC2965 OIDC Discovery implementation #4064

Merged
merged 15 commits into from
Feb 23, 2024
Merged

Conversation

t3chguy
Copy link
Member

@t3chguy t3chguy commented Feb 13, 2024

https://github.com/sandhose/matrix-doc/blob/msc/sandhose/oidc-discovery/proposals/2965-oidc-discovery.md

Switches from m.authentication in .well-known/matrix/client to GET /auth_issuer API as the MSC has done.

Requires #4074


Here's what your changelog entry will look like:

✨ Features

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

Help me out here. This is a chunky change, and is going to be time-consuming to review without any context.

What is the actual change in behaviour here, in more detail than "update"? I see the link to the MSC doc, but that in itself is a chunky document, and presumably some of it was previously implemented?

Is it possible to break up the change a bit, to make it easier to review (eg, it looks like one of the changes is to strip out support for m.authentication? I don't really understand why that's happening, given the MSC still seems to talk about it, but can you pull that out to its own commit or its own PR?)

@t3chguy
Copy link
Member Author

t3chguy commented Feb 14, 2024

What is the actual change in behaviour here, in more detail than "update"?

I don't really understand why that's happening, given the MSC still seems to talk about it, but can you pull that out to its own commit or its own PR?)

The MSC moved from advertising the OIDC issuer via .well-known/matrix/client to a dedicated API GET /auth_issuer - the references in the MSC to m.authentication are in the Alternatives section for this reason. Its quite entangled so not sure how to sanely split this out without the individual commits not being atomic.

@richvdh richvdh self-requested a review February 14, 2024 16:50
@richvdh
Copy link
Member

richvdh commented Feb 15, 2024

Its quite entangled so not sure how to sanely split this out without the individual commits not being atomic.

A few ideas to kick you off:

  • OidcClientConfig is moving to a new file. Pull out the move to its own commit.
  • There seems to be a formatting change to spec/unit/oidc/authorize.spec.ts ? Let's separate formatting cleanups from functional changes.
  • Make adding support for account_management_endpoint its own commit.
  • validateDiscoveryAuthenticationConfig isn't currently used anywhere afaict? Make ripping it out its own commit.

Those are just a few ideas I found quickly. I'm sure there are others; like I say, I'm finding it hard to follow at the moment so I'm not in the best place to advise. It doesn't matter if some of those commits end up being trivial; it all helps to reduce the amount of state a reviewer has to keep in their head at once.

@richvdh
Copy link
Member

richvdh commented Feb 15, 2024

I realise a lot of this is marked @experimental, but surely there is something using it somewhere that is going to be broken? What's the plan for managing that?

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

A few drive-by comments

src/client.ts Outdated Show resolved Hide resolved
src/autodiscovery.ts Outdated Show resolved Hide resolved
src/oidc/index.ts Show resolved Hide resolved
@@ -897,75 +871,4 @@ describe("AutoDiscovery", function () {
}),
]);
});

describe("m.authentication", () => {
Copy link
Member

Choose a reason for hiding this comment

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

I appreciate these tests don't really apply any more, but it worries me to see tests being ripped out without new ones to replace them. Shouldn't we have similar tests for the new endpoint?

Copy link
Member Author

Choose a reason for hiding this comment

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

We have a test for the new endpoint now, it landed as its own PR.

As for the rest of it, its just removing code and changing types, given tests have been updated with stubs matching the new types I'd consider that tested

src/oidc/discovery.ts Show resolved Hide resolved
@t3chguy t3chguy marked this pull request as draft February 16, 2024 17:51
@t3chguy
Copy link
Member Author

t3chguy commented Feb 19, 2024

Have split out #4071 - will rebase this PR and split into sane commits afterwards

…m it

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
… response

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
@t3chguy
Copy link
Member Author

t3chguy commented Feb 19, 2024

What's the plan for managing that?

matrix-org/matrix-react-sdk#12245

…chguy/fix/26908

# Conflicts:
#	spec/unit/oidc/authorize.spec.ts
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
…ported` from OIDC Issuer well-known

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
…x-js-sdk into t3chguy/fix/26908

# Conflicts:
#	src/oidc/validate.ts
Base automatically changed from t3chguy/oidc-extensions to develop February 21, 2024 15:17
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

Seems generally sensible. A nit, and a question.

src/oidc/index.ts Outdated Show resolved Hide resolved
src/oidc/register.ts Show resolved Hide resolved
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

Was there an answer to my question at #4064 (comment)?

Also would like to see a mention of .well-known/openid-configuration somewhere in the doc-comments, per #4064 (comment).

LGTM otherwise

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
@t3chguy t3chguy merged commit a26fc46 into develop Feb 23, 2024
23 checks passed
@t3chguy t3chguy deleted the t3chguy/fix/26908 branch February 23, 2024 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants