Skip to content

Commit

Permalink
Remove usage of v1 Identity Server API (#3003)
Browse files Browse the repository at this point in the history
* Remove usage of v1 Identity Server API

It's been deprecated for over a year at this point - everyone should be able to support v2.

* Missed one.
  • Loading branch information
turt2live authored Jan 3, 2023
1 parent 0f717a9 commit 7d37bb1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
12 changes: 6 additions & 6 deletions spec/unit/autodiscovery.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ describe("AutoDiscovery", function () {
.respond(200, {
versions: ["r0.0.1"],
});
httpBackend.when("GET", "/_matrix/identity/api/v1").respond(404, {});
httpBackend.when("GET", "/_matrix/identity/v2").respond(404, {});
httpBackend.when("GET", "/.well-known/matrix/client").respond(200, {
"m.homeserver": {
// Note: we also expect this test to trim the trailing slash
Expand Down Expand Up @@ -591,7 +591,7 @@ describe("AutoDiscovery", function () {
.respond(200, {
versions: ["r0.0.1"],
});
httpBackend.when("GET", "/_matrix/identity/api/v1").respond(500, {});
httpBackend.when("GET", "/_matrix/identity/v2").respond(500, {});
httpBackend.when("GET", "/.well-known/matrix/client").respond(200, {
"m.homeserver": {
// Note: we also expect this test to trim the trailing slash
Expand Down Expand Up @@ -636,9 +636,9 @@ describe("AutoDiscovery", function () {
versions: ["r0.0.1"],
});
httpBackend
.when("GET", "/_matrix/identity/api/v1")
.when("GET", "/_matrix/identity/v2")
.check((req) => {
expect(req.path).toEqual("https://identity.example.org/_matrix/identity/api/v1");
expect(req.path).toEqual("https://identity.example.org/_matrix/identity/v2");
})
.respond(200, {});
httpBackend.when("GET", "/.well-known/matrix/client").respond(200, {
Expand Down Expand Up @@ -682,9 +682,9 @@ describe("AutoDiscovery", function () {
versions: ["r0.0.1"],
});
httpBackend
.when("GET", "/_matrix/identity/api/v1")
.when("GET", "/_matrix/identity/v2")
.check((req) => {
expect(req.path).toEqual("https://identity.example.org/_matrix/identity/api/v1");
expect(req.path).toEqual("https://identity.example.org/_matrix/identity/v2");
})
.respond(200, {});
httpBackend.when("GET", "/.well-known/matrix/client").respond(200, {
Expand Down
4 changes: 2 additions & 2 deletions src/autodiscovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ export class AutoDiscovery {

// Step 5b: Verify there is an identity server listening on the provided
// URL.
const isResponse = await this.fetchWellKnownObject(`${isUrl}/_matrix/identity/api/v1`);
const isResponse = await this.fetchWellKnownObject(`${isUrl}/_matrix/identity/v2`);
if (!isResponse?.raw || isResponse.action !== AutoDiscoveryAction.SUCCESS) {
logger.error("Invalid /api/v1 response");
logger.error("Invalid /v2 response");
failingClientConfig["m.identity_server"].error = AutoDiscovery.ERROR_INVALID_IDENTITY_SERVER;

// Supply the base_url to the caller because they may be ignoring
Expand Down
5 changes: 0 additions & 5 deletions src/http-api/prefix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ export enum ClientPrefix {
}

export enum IdentityPrefix {
/**
* URI path for v1 of the identity API
* @deprecated Use v2.
*/
V1 = "/_matrix/identity/api/v1",
/**
* URI path for the v2 identity API
*/
Expand Down

0 comments on commit 7d37bb1

Please sign in to comment.