Skip to content

Commit 79a6c58

Browse files
Release v3.1.1 (#246)
Co-authored-by: Hurby <69755274+hurby24@users.noreply.github.com>
1 parent bb87ae9 commit 79a6c58

File tree

5 files changed

+27
-6
lines changed

5 files changed

+27
-6
lines changed

.RELEASE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fix Authentik endpoints ([#244](https://github.com/pilcrowonpaper/arctic/issues/244)).

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "arctic",
33
"type": "module",
4-
"version": "3.1.0",
4+
"version": "3.1.1",
55
"description": "OAuth 2.0 clients for popular providers",
66
"main": "dist/index.js",
77
"types": "dist/index.d.ts",

src/providers/authentik.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ export class Authentik {
1111
private client: OAuth2Client;
1212

1313
constructor(baseURL: string, clientId: string, clientSecret: string | null, redirectURI: string) {
14-
this.authorizationEndpoint = joinURIAndPath(baseURL, "/application/o/authorize");
15-
this.tokenEndpoint = joinURIAndPath(baseURL, "/application/o/token");
16-
this.tokenRevocationEndpoint = joinURIAndPath(baseURL, "/application/o/revoke");
14+
this.authorizationEndpoint = joinURIAndPath(baseURL, "/application/o/authorize/");
15+
this.tokenEndpoint = joinURIAndPath(baseURL, "/application/o/token/");
16+
this.tokenRevocationEndpoint = joinURIAndPath(baseURL, "/application/o/revoke/");
1717
this.client = new OAuth2Client(clientId, clientSecret, redirectURI);
1818
}
1919

src/request.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import * as vitest from "vitest";
2+
3+
import { joinURIAndPath } from "./request.js";
4+
5+
vitest.test("joinBaseURIAndPath()", () => {
6+
vitest.expect(joinURIAndPath("https://example.com", "/hi")).toBe("https://example.com/hi");
7+
vitest.expect(joinURIAndPath("https://example.com/", "/hi")).toBe("https://example.com/hi");
8+
vitest.expect(joinURIAndPath("https://example.com/", "hi")).toBe("https://example.com/hi");
9+
vitest.expect(joinURIAndPath("https://example.com", "hi")).toBe("https://example.com/hi");
10+
vitest.expect(joinURIAndPath("https://example.com", "/hi/")).toBe("https://example.com/hi/");
11+
12+
vitest
13+
.expect(joinURIAndPath("https://example.com", "/hi", "/bye"))
14+
.toBe("https://example.com/hi/bye");
15+
vitest
16+
.expect(joinURIAndPath("https://example.com", "hi", "bye"))
17+
.toBe("https://example.com/hi/bye");
18+
vitest
19+
.expect(joinURIAndPath("https://example.com", "/hi/", "/bye/"))
20+
.toBe("https://example.com/hi/bye/");
21+
});

src/request.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import { trimLeft, trimRight } from "./utils.js";
55
export function joinURIAndPath(base: string, ...path: string[]): string {
66
let joined = trimRight(base, "/");
77
for (const part of path) {
8-
joined += "/";
9-
joined += trimRight(trimLeft(part, "/"), "/");
8+
joined = trimRight(joined, "/") + "/" + trimLeft(part, "/");
109
}
1110
return joined;
1211
}

0 commit comments

Comments
 (0)