-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(endpoint-token): return 403 if token URL doesn’t match publicatio…
…n URL
- Loading branch information
1 parent
8720945
commit 807690e
Showing
3 changed files
with
37 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
packages/endpoint-token/tests/integration/403-verify-token-error-me-mismatch.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import test from "ava"; | ||
import { testServer } from "@indiekit-test/server"; | ||
|
||
test("Returns 403 if publication URL doesn’t match URL in token", async (t) => { | ||
const request = await testServer({ | ||
publication: { | ||
me: 'https://server.example' | ||
} | ||
}); | ||
const result = await request | ||
.get("/token") | ||
.auth(process.env.TEST_TOKEN, { type: "bearer" }) | ||
.set("Accept", "application/json"); | ||
|
||
t.is(result.status, 403); | ||
t.is(result.body.error_description, "Publication URL does not match that provided by access token"); | ||
}); |