@edcalderon/auth 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +3 -3
- package/dist/authentik/index.d.ts +2 -0
- package/dist/authentik/index.js +2 -0
- package/dist/authentik/preset.d.ts +42 -0
- package/dist/authentik/preset.js +51 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.4.2] - 2026-03-30
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- ✨ **Authentik preset helpers** — `createAuthentikPreset()`, `createAuthentikRelayHandler()`, `createAuthentikLogoutHandler()`, and `handleAuthentikCallback()` wrap the existing relay/callback/logout/provisioning primitives into a reusable config-first flow.
|
|
8
|
+
- 📦 **New `@edcalderon/auth/authentik` exports** — the preset layer is now part of the Authentik subpath export surface.
|
|
9
|
+
|
|
3
10
|
## [1.4.1] - 2026-03-23
|
|
4
11
|
|
|
5
12
|
### Added
|
package/README.md
CHANGED
|
@@ -11,12 +11,12 @@ Swap between Supabase, Firebase, Hybrid, or any custom provider without changing
|
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
## 📋 Latest Changes (v1.4.
|
|
14
|
+
## 📋 Latest Changes (v1.4.2)
|
|
15
15
|
|
|
16
16
|
### Added
|
|
17
17
|
|
|
18
|
-
-
|
|
19
|
-
-
|
|
18
|
+
- ✨ **Authentik preset helpers** — `createAuthentikPreset()`, `createAuthentikRelayHandler()`, `createAuthentikLogoutHandler()`, and `handleAuthentikCallback()` wrap the existing relay/callback/logout/provisioning primitives into a reusable config-first flow.
|
|
19
|
+
- 📦 **New `@edcalderon/auth/authentik` exports** — the preset layer is now part of the Authentik subpath export surface.
|
|
20
20
|
|
|
21
21
|
For full version history, see [CHANGELOG.md](./CHANGELOG.md) and [GitHub releases](https://github.com/edcalderon/my-second-brain/releases)
|
|
22
22
|
|
|
@@ -15,3 +15,5 @@ export { revokeToken, buildEndSessionUrl, orchestrateLogout, } from "./logout";
|
|
|
15
15
|
export { NoopProvisioningAdapter, createProvisioningAdapter, normalizePayload, SupabaseSyncAdapter, createSupabaseSyncAdapter, } from "./provisioning";
|
|
16
16
|
export { validateAuthentikConfig, validateSupabaseSyncConfig, validateFullConfig, discoverEndpoints, } from "./config";
|
|
17
17
|
export { resolveSafeRedirect } from "./redirect";
|
|
18
|
+
export { createAuthentikPreset, createAuthentikRelayHandler, createAuthentikLogoutHandler, handleAuthentikCallback, } from "./preset";
|
|
19
|
+
export type { AuthentikPreset, AuthentikPresetConfig, CreateAuthentikPresetOptions, HandleAuthentikCallbackInput, AuthentikRelayHandler, } from "./preset";
|
package/dist/authentik/index.js
CHANGED
|
@@ -19,4 +19,6 @@ export { NoopProvisioningAdapter, createProvisioningAdapter, normalizePayload, S
|
|
|
19
19
|
export { validateAuthentikConfig, validateSupabaseSyncConfig, validateFullConfig, discoverEndpoints, } from "./config";
|
|
20
20
|
// Safe redirect
|
|
21
21
|
export { resolveSafeRedirect } from "./redirect";
|
|
22
|
+
// Preset helpers
|
|
23
|
+
export { createAuthentikPreset, createAuthentikRelayHandler, createAuthentikLogoutHandler, handleAuthentikCallback, } from "./preset";
|
|
22
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type ProcessCallbackResult } from "./callback";
|
|
2
|
+
import { orchestrateLogout } from "./logout";
|
|
3
|
+
import type { AuthentikCallbackConfig, AuthentikLogoutConfig, AuthentikRelayConfig, ProvisioningAdapter, SupabaseSyncConfig, ConfigValidationResult } from "./types";
|
|
4
|
+
export interface AuthentikPresetConfig {
|
|
5
|
+
relay: AuthentikRelayConfig;
|
|
6
|
+
callback: AuthentikCallbackConfig;
|
|
7
|
+
logout: AuthentikLogoutConfig;
|
|
8
|
+
provisioningAdapter?: ProvisioningAdapter;
|
|
9
|
+
}
|
|
10
|
+
export interface CreateAuthentikPresetOptions {
|
|
11
|
+
relay: AuthentikRelayConfig;
|
|
12
|
+
callback: AuthentikCallbackConfig;
|
|
13
|
+
logout: AuthentikLogoutConfig;
|
|
14
|
+
provisioningAdapter?: ProvisioningAdapter;
|
|
15
|
+
supabaseSync?: SupabaseSyncConfig;
|
|
16
|
+
}
|
|
17
|
+
export interface AuthentikPreset {
|
|
18
|
+
config: AuthentikPresetConfig;
|
|
19
|
+
validateConfig(): ConfigValidationResult;
|
|
20
|
+
}
|
|
21
|
+
export interface HandleAuthentikCallbackInput {
|
|
22
|
+
code: string;
|
|
23
|
+
codeVerifier: string;
|
|
24
|
+
state: string;
|
|
25
|
+
expectedState: string;
|
|
26
|
+
provider: string;
|
|
27
|
+
}
|
|
28
|
+
export type AuthentikRelayHandler = (searchParams: URLSearchParams | Record<string, string | undefined>) => {
|
|
29
|
+
ok: true;
|
|
30
|
+
html: string;
|
|
31
|
+
} | {
|
|
32
|
+
ok: false;
|
|
33
|
+
error: string;
|
|
34
|
+
errorCode: string;
|
|
35
|
+
};
|
|
36
|
+
export declare function createAuthentikRelayHandler(config: AuthentikRelayConfig): AuthentikRelayHandler;
|
|
37
|
+
export declare function handleAuthentikCallback(preset: AuthentikPreset, input: HandleAuthentikCallbackInput): Promise<ProcessCallbackResult>;
|
|
38
|
+
export declare function createAuthentikLogoutHandler(config: AuthentikLogoutConfig): (tokens: {
|
|
39
|
+
accessToken?: string;
|
|
40
|
+
idToken?: string;
|
|
41
|
+
}) => ReturnType<typeof orchestrateLogout>;
|
|
42
|
+
export declare function createAuthentikPreset(options: CreateAuthentikPresetOptions): AuthentikPreset;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { createRelayPageHtml, parseRelayParams, } from "./relay";
|
|
2
|
+
import { processCallback } from "./callback";
|
|
3
|
+
import { orchestrateLogout } from "./logout";
|
|
4
|
+
import { validateAuthentikConfig, validateFullConfig, } from "./config";
|
|
5
|
+
export function createAuthentikRelayHandler(config) {
|
|
6
|
+
return (searchParams) => {
|
|
7
|
+
const params = parseRelayParams(searchParams);
|
|
8
|
+
if (!params) {
|
|
9
|
+
return {
|
|
10
|
+
ok: false,
|
|
11
|
+
error: "Missing required relay parameters",
|
|
12
|
+
errorCode: "relay_params_missing",
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const result = createRelayPageHtml(config, params);
|
|
16
|
+
return { ok: true, html: result.html };
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function handleAuthentikCallback(preset, input) {
|
|
20
|
+
return processCallback({
|
|
21
|
+
config: preset.config.callback,
|
|
22
|
+
code: input.code,
|
|
23
|
+
codeVerifier: input.codeVerifier,
|
|
24
|
+
state: input.state,
|
|
25
|
+
expectedState: input.expectedState,
|
|
26
|
+
provider: input.provider,
|
|
27
|
+
provisioningAdapter: preset.config.provisioningAdapter,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
export function createAuthentikLogoutHandler(config) {
|
|
31
|
+
return (tokens) => orchestrateLogout(config, tokens);
|
|
32
|
+
}
|
|
33
|
+
export function createAuthentikPreset(options) {
|
|
34
|
+
const provisioningAdapter = options.provisioningAdapter;
|
|
35
|
+
const presetConfig = {
|
|
36
|
+
relay: options.relay,
|
|
37
|
+
callback: options.callback,
|
|
38
|
+
logout: options.logout,
|
|
39
|
+
provisioningAdapter,
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
config: presetConfig,
|
|
43
|
+
validateConfig: () => {
|
|
44
|
+
if (options.supabaseSync) {
|
|
45
|
+
return validateFullConfig(options.callback, options.supabaseSync);
|
|
46
|
+
}
|
|
47
|
+
return validateAuthentikConfig(options.callback);
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=preset.js.map
|