@descope/nextjs-sdk 0.0.0-next-3ba7f03f-20240207
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/LICENSE +21 -0
- package/README.md +254 -0
- package/dist/client/dts/src/client/index.d.ts +1 -0
- package/dist/client/dts/src/index.d.ts +1 -0
- package/dist/client/dts/src/server/authMiddleware.d.ts +8 -0
- package/dist/client/dts/src/server/constants.d.ts +5 -0
- package/dist/client/dts/src/server/index.d.ts +3 -0
- package/dist/client/dts/src/server/sdk.d.ts +8 -0
- package/dist/client/dts/src/server/session.d.ts +4 -0
- package/dist/client/dts/src/shared/AuthProvider.d.ts +4 -0
- package/dist/client/dts/src/shared/DescopeFlows.d.ts +156 -0
- package/dist/client/dts/src/shared/index.d.ts +2 -0
- package/dist/client/dts/src/types.d.ts +1 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.js +3 -0
- package/dist/client/index.js.map +1 -0
- package/dist/dts/src/client/index.d.ts +1 -0
- package/dist/dts/src/index.d.ts +1 -0
- package/dist/dts/src/server/authMiddleware.d.ts +8 -0
- package/dist/dts/src/server/constants.d.ts +5 -0
- package/dist/dts/src/server/index.d.ts +3 -0
- package/dist/dts/src/server/sdk.d.ts +8 -0
- package/dist/dts/src/server/session.d.ts +4 -0
- package/dist/dts/src/shared/AuthProvider.d.ts +4 -0
- package/dist/dts/src/shared/DescopeFlows.d.ts +156 -0
- package/dist/dts/src/shared/index.d.ts +2 -0
- package/dist/dts/src/types.d.ts +1 -0
- package/dist/index.d.ts +162 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/server/authMiddleware.js +69 -0
- package/dist/server/authMiddleware.js.map +1 -0
- package/dist/server/constants.js +9 -0
- package/dist/server/constants.js.map +1 -0
- package/dist/server/dts/src/client/index.d.ts +1 -0
- package/dist/server/dts/src/index.d.ts +1 -0
- package/dist/server/dts/src/server/authMiddleware.d.ts +8 -0
- package/dist/server/dts/src/server/constants.d.ts +5 -0
- package/dist/server/dts/src/server/index.d.ts +3 -0
- package/dist/server/dts/src/server/sdk.d.ts +8 -0
- package/dist/server/dts/src/server/session.d.ts +4 -0
- package/dist/server/dts/src/shared/AuthProvider.d.ts +4 -0
- package/dist/server/dts/src/shared/DescopeFlows.d.ts +156 -0
- package/dist/server/dts/src/shared/index.d.ts +2 -0
- package/dist/server/dts/src/types.d.ts +1 -0
- package/dist/server/index.d.ts +21 -0
- package/dist/server/index.js +4 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/sdk.js +26 -0
- package/dist/server/sdk.js.map +1 -0
- package/dist/server/session.js +24 -0
- package/dist/server/session.js.map +1 -0
- package/dist/shared/AuthProvider.js +10 -0
- package/dist/shared/AuthProvider.js.map +1 -0
- package/dist/shared/DescopeFlows.js +42 -0
- package/dist/shared/DescopeFlows.js.map +1 -0
- package/package.json +145 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type AdditionalProps = {
|
|
3
|
+
redirectAfterSuccess?: string;
|
|
4
|
+
redirectAfterError?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const Descope: React.ComponentType<(({
|
|
7
|
+
flowId: string;
|
|
8
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
9
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
10
|
+
logger?: import("@descope/web-component").ILogger;
|
|
11
|
+
tenant?: string;
|
|
12
|
+
theme?: import("@descope/web-component").ThemeOptions;
|
|
13
|
+
locale?: string;
|
|
14
|
+
autoFocus?: import("@descope/web-component").AutoFocusOptions;
|
|
15
|
+
debug?: boolean;
|
|
16
|
+
telemetryKey?: string;
|
|
17
|
+
redirectUrl?: string;
|
|
18
|
+
errorTransformer?: (error: {
|
|
19
|
+
text: string;
|
|
20
|
+
type: string;
|
|
21
|
+
}) => string;
|
|
22
|
+
form?: Record<string, any>;
|
|
23
|
+
client?: Record<string, any>;
|
|
24
|
+
} & React.RefAttributes<HTMLElement>) | ({
|
|
25
|
+
flowId: string;
|
|
26
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
27
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
28
|
+
logger?: import("@descope/web-component").ILogger;
|
|
29
|
+
tenant?: string;
|
|
30
|
+
theme?: import("@descope/web-component").ThemeOptions;
|
|
31
|
+
locale?: string;
|
|
32
|
+
autoFocus?: import("@descope/web-component").AutoFocusOptions;
|
|
33
|
+
debug?: boolean;
|
|
34
|
+
telemetryKey?: string;
|
|
35
|
+
redirectUrl?: string;
|
|
36
|
+
errorTransformer?: (error: {
|
|
37
|
+
text: string;
|
|
38
|
+
type: string;
|
|
39
|
+
}) => string;
|
|
40
|
+
form?: Record<string, any>;
|
|
41
|
+
client?: Record<string, any>;
|
|
42
|
+
} & React.RefAttributes<HTMLElement> & {
|
|
43
|
+
children?: React.ReactNode;
|
|
44
|
+
})) & AdditionalProps>;
|
|
45
|
+
export declare const SignInFlow: React.ComponentType<({
|
|
46
|
+
form?: Record<string, any>;
|
|
47
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
48
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
49
|
+
logger?: import("@descope/web-component").ILogger;
|
|
50
|
+
tenant?: string;
|
|
51
|
+
theme?: import("@descope/web-component").ThemeOptions;
|
|
52
|
+
locale?: string;
|
|
53
|
+
autoFocus?: import("@descope/web-component").AutoFocusOptions;
|
|
54
|
+
debug?: boolean;
|
|
55
|
+
telemetryKey?: string;
|
|
56
|
+
redirectUrl?: string;
|
|
57
|
+
errorTransformer?: (error: {
|
|
58
|
+
text: string;
|
|
59
|
+
type: string;
|
|
60
|
+
}) => string;
|
|
61
|
+
client?: Record<string, any>;
|
|
62
|
+
} | ({
|
|
63
|
+
form?: Record<string, any>;
|
|
64
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
65
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
66
|
+
logger?: import("@descope/web-component").ILogger;
|
|
67
|
+
tenant?: string;
|
|
68
|
+
theme?: import("@descope/web-component").ThemeOptions;
|
|
69
|
+
locale?: string;
|
|
70
|
+
autoFocus?: import("@descope/web-component").AutoFocusOptions;
|
|
71
|
+
debug?: boolean;
|
|
72
|
+
telemetryKey?: string;
|
|
73
|
+
redirectUrl?: string;
|
|
74
|
+
errorTransformer?: (error: {
|
|
75
|
+
text: string;
|
|
76
|
+
type: string;
|
|
77
|
+
}) => string;
|
|
78
|
+
client?: Record<string, any>;
|
|
79
|
+
} & {
|
|
80
|
+
children?: React.ReactNode;
|
|
81
|
+
})) & AdditionalProps>;
|
|
82
|
+
export declare const SignUpFlow: React.ComponentType<({
|
|
83
|
+
form?: Record<string, any>;
|
|
84
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
85
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
86
|
+
logger?: import("@descope/web-component").ILogger;
|
|
87
|
+
tenant?: string;
|
|
88
|
+
theme?: import("@descope/web-component").ThemeOptions;
|
|
89
|
+
locale?: string;
|
|
90
|
+
autoFocus?: import("@descope/web-component").AutoFocusOptions;
|
|
91
|
+
debug?: boolean;
|
|
92
|
+
telemetryKey?: string;
|
|
93
|
+
redirectUrl?: string;
|
|
94
|
+
errorTransformer?: (error: {
|
|
95
|
+
text: string;
|
|
96
|
+
type: string;
|
|
97
|
+
}) => string;
|
|
98
|
+
client?: Record<string, any>;
|
|
99
|
+
} | ({
|
|
100
|
+
form?: Record<string, any>;
|
|
101
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
102
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
103
|
+
logger?: import("@descope/web-component").ILogger;
|
|
104
|
+
tenant?: string;
|
|
105
|
+
theme?: import("@descope/web-component").ThemeOptions;
|
|
106
|
+
locale?: string;
|
|
107
|
+
autoFocus?: import("@descope/web-component").AutoFocusOptions;
|
|
108
|
+
debug?: boolean;
|
|
109
|
+
telemetryKey?: string;
|
|
110
|
+
redirectUrl?: string;
|
|
111
|
+
errorTransformer?: (error: {
|
|
112
|
+
text: string;
|
|
113
|
+
type: string;
|
|
114
|
+
}) => string;
|
|
115
|
+
client?: Record<string, any>;
|
|
116
|
+
} & {
|
|
117
|
+
children?: React.ReactNode;
|
|
118
|
+
})) & AdditionalProps>;
|
|
119
|
+
export declare const SignUpOrInFlow: React.ComponentType<({
|
|
120
|
+
form?: Record<string, any>;
|
|
121
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
122
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
123
|
+
logger?: import("@descope/web-component").ILogger;
|
|
124
|
+
tenant?: string;
|
|
125
|
+
theme?: import("@descope/web-component").ThemeOptions;
|
|
126
|
+
locale?: string;
|
|
127
|
+
autoFocus?: import("@descope/web-component").AutoFocusOptions;
|
|
128
|
+
debug?: boolean;
|
|
129
|
+
telemetryKey?: string;
|
|
130
|
+
redirectUrl?: string;
|
|
131
|
+
errorTransformer?: (error: {
|
|
132
|
+
text: string;
|
|
133
|
+
type: string;
|
|
134
|
+
}) => string;
|
|
135
|
+
client?: Record<string, any>;
|
|
136
|
+
} | ({
|
|
137
|
+
form?: Record<string, any>;
|
|
138
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
139
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
140
|
+
logger?: import("@descope/web-component").ILogger;
|
|
141
|
+
tenant?: string;
|
|
142
|
+
theme?: import("@descope/web-component").ThemeOptions;
|
|
143
|
+
locale?: string;
|
|
144
|
+
autoFocus?: import("@descope/web-component").AutoFocusOptions;
|
|
145
|
+
debug?: boolean;
|
|
146
|
+
telemetryKey?: string;
|
|
147
|
+
redirectUrl?: string;
|
|
148
|
+
errorTransformer?: (error: {
|
|
149
|
+
text: string;
|
|
150
|
+
type: string;
|
|
151
|
+
}) => string;
|
|
152
|
+
client?: Record<string, any>;
|
|
153
|
+
} & {
|
|
154
|
+
children?: React.ReactNode;
|
|
155
|
+
})) & AdditionalProps>;
|
|
156
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type TempType = {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import React, { ComponentProps } from 'react';
|
|
2
|
+
import { AuthProvider as AuthProvider$1 } from '@descope/react-sdk';
|
|
3
|
+
import * as _descope_web_component from '@descope/web-component';
|
|
4
|
+
|
|
5
|
+
declare const AuthProvider: (props: ComponentProps<typeof AuthProvider$1>) => React.JSX.Element;
|
|
6
|
+
|
|
7
|
+
type AdditionalProps = {
|
|
8
|
+
redirectAfterSuccess?: string;
|
|
9
|
+
redirectAfterError?: string;
|
|
10
|
+
};
|
|
11
|
+
declare const Descope: React.ComponentType<(({
|
|
12
|
+
flowId: string;
|
|
13
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
14
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
15
|
+
logger?: _descope_web_component.ILogger;
|
|
16
|
+
tenant?: string;
|
|
17
|
+
theme?: _descope_web_component.ThemeOptions;
|
|
18
|
+
locale?: string;
|
|
19
|
+
autoFocus?: _descope_web_component.AutoFocusOptions;
|
|
20
|
+
debug?: boolean;
|
|
21
|
+
telemetryKey?: string;
|
|
22
|
+
redirectUrl?: string;
|
|
23
|
+
errorTransformer?: (error: {
|
|
24
|
+
text: string;
|
|
25
|
+
type: string;
|
|
26
|
+
}) => string;
|
|
27
|
+
form?: Record<string, any>;
|
|
28
|
+
client?: Record<string, any>;
|
|
29
|
+
} & React.RefAttributes<HTMLElement>) | ({
|
|
30
|
+
flowId: string;
|
|
31
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
32
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
33
|
+
logger?: _descope_web_component.ILogger;
|
|
34
|
+
tenant?: string;
|
|
35
|
+
theme?: _descope_web_component.ThemeOptions;
|
|
36
|
+
locale?: string;
|
|
37
|
+
autoFocus?: _descope_web_component.AutoFocusOptions;
|
|
38
|
+
debug?: boolean;
|
|
39
|
+
telemetryKey?: string;
|
|
40
|
+
redirectUrl?: string;
|
|
41
|
+
errorTransformer?: (error: {
|
|
42
|
+
text: string;
|
|
43
|
+
type: string;
|
|
44
|
+
}) => string;
|
|
45
|
+
form?: Record<string, any>;
|
|
46
|
+
client?: Record<string, any>;
|
|
47
|
+
} & React.RefAttributes<HTMLElement> & {
|
|
48
|
+
children?: React.ReactNode;
|
|
49
|
+
})) & AdditionalProps>;
|
|
50
|
+
declare const SignInFlow: React.ComponentType<({
|
|
51
|
+
form?: Record<string, any>;
|
|
52
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
53
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
54
|
+
logger?: _descope_web_component.ILogger;
|
|
55
|
+
tenant?: string;
|
|
56
|
+
theme?: _descope_web_component.ThemeOptions;
|
|
57
|
+
locale?: string;
|
|
58
|
+
autoFocus?: _descope_web_component.AutoFocusOptions;
|
|
59
|
+
debug?: boolean;
|
|
60
|
+
telemetryKey?: string;
|
|
61
|
+
redirectUrl?: string;
|
|
62
|
+
errorTransformer?: (error: {
|
|
63
|
+
text: string;
|
|
64
|
+
type: string;
|
|
65
|
+
}) => string;
|
|
66
|
+
client?: Record<string, any>;
|
|
67
|
+
} | ({
|
|
68
|
+
form?: Record<string, any>;
|
|
69
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
70
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
71
|
+
logger?: _descope_web_component.ILogger;
|
|
72
|
+
tenant?: string;
|
|
73
|
+
theme?: _descope_web_component.ThemeOptions;
|
|
74
|
+
locale?: string;
|
|
75
|
+
autoFocus?: _descope_web_component.AutoFocusOptions;
|
|
76
|
+
debug?: boolean;
|
|
77
|
+
telemetryKey?: string;
|
|
78
|
+
redirectUrl?: string;
|
|
79
|
+
errorTransformer?: (error: {
|
|
80
|
+
text: string;
|
|
81
|
+
type: string;
|
|
82
|
+
}) => string;
|
|
83
|
+
client?: Record<string, any>;
|
|
84
|
+
} & {
|
|
85
|
+
children?: React.ReactNode;
|
|
86
|
+
})) & AdditionalProps>;
|
|
87
|
+
declare const SignUpFlow: React.ComponentType<({
|
|
88
|
+
form?: Record<string, any>;
|
|
89
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
90
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
91
|
+
logger?: _descope_web_component.ILogger;
|
|
92
|
+
tenant?: string;
|
|
93
|
+
theme?: _descope_web_component.ThemeOptions;
|
|
94
|
+
locale?: string;
|
|
95
|
+
autoFocus?: _descope_web_component.AutoFocusOptions;
|
|
96
|
+
debug?: boolean;
|
|
97
|
+
telemetryKey?: string;
|
|
98
|
+
redirectUrl?: string;
|
|
99
|
+
errorTransformer?: (error: {
|
|
100
|
+
text: string;
|
|
101
|
+
type: string;
|
|
102
|
+
}) => string;
|
|
103
|
+
client?: Record<string, any>;
|
|
104
|
+
} | ({
|
|
105
|
+
form?: Record<string, any>;
|
|
106
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
107
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
108
|
+
logger?: _descope_web_component.ILogger;
|
|
109
|
+
tenant?: string;
|
|
110
|
+
theme?: _descope_web_component.ThemeOptions;
|
|
111
|
+
locale?: string;
|
|
112
|
+
autoFocus?: _descope_web_component.AutoFocusOptions;
|
|
113
|
+
debug?: boolean;
|
|
114
|
+
telemetryKey?: string;
|
|
115
|
+
redirectUrl?: string;
|
|
116
|
+
errorTransformer?: (error: {
|
|
117
|
+
text: string;
|
|
118
|
+
type: string;
|
|
119
|
+
}) => string;
|
|
120
|
+
client?: Record<string, any>;
|
|
121
|
+
} & {
|
|
122
|
+
children?: React.ReactNode;
|
|
123
|
+
})) & AdditionalProps>;
|
|
124
|
+
declare const SignUpOrInFlow: React.ComponentType<({
|
|
125
|
+
form?: Record<string, any>;
|
|
126
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
127
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
128
|
+
logger?: _descope_web_component.ILogger;
|
|
129
|
+
tenant?: string;
|
|
130
|
+
theme?: _descope_web_component.ThemeOptions;
|
|
131
|
+
locale?: string;
|
|
132
|
+
autoFocus?: _descope_web_component.AutoFocusOptions;
|
|
133
|
+
debug?: boolean;
|
|
134
|
+
telemetryKey?: string;
|
|
135
|
+
redirectUrl?: string;
|
|
136
|
+
errorTransformer?: (error: {
|
|
137
|
+
text: string;
|
|
138
|
+
type: string;
|
|
139
|
+
}) => string;
|
|
140
|
+
client?: Record<string, any>;
|
|
141
|
+
} | ({
|
|
142
|
+
form?: Record<string, any>;
|
|
143
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
144
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
145
|
+
logger?: _descope_web_component.ILogger;
|
|
146
|
+
tenant?: string;
|
|
147
|
+
theme?: _descope_web_component.ThemeOptions;
|
|
148
|
+
locale?: string;
|
|
149
|
+
autoFocus?: _descope_web_component.AutoFocusOptions;
|
|
150
|
+
debug?: boolean;
|
|
151
|
+
telemetryKey?: string;
|
|
152
|
+
redirectUrl?: string;
|
|
153
|
+
errorTransformer?: (error: {
|
|
154
|
+
text: string;
|
|
155
|
+
type: string;
|
|
156
|
+
}) => string;
|
|
157
|
+
client?: Record<string, any>;
|
|
158
|
+
} & {
|
|
159
|
+
children?: React.ReactNode;
|
|
160
|
+
})) & AdditionalProps>;
|
|
161
|
+
|
|
162
|
+
export { AuthProvider, Descope, SignInFlow, SignUpFlow, SignUpOrInFlow };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { NextResponse } from 'next/server';
|
|
2
|
+
import descopeSdk from '@descope/node-sdk';
|
|
3
|
+
import { DESCOPE_SESSION_HEADER } from './constants.js';
|
|
4
|
+
import { getGlobalSdk } from './sdk.js';
|
|
5
|
+
|
|
6
|
+
/* eslint-disable no-console */
|
|
7
|
+
const getSessionJwt = (req) => {
|
|
8
|
+
let jwt = req.headers?.get('Authorization')?.split(' ')[1];
|
|
9
|
+
if (jwt) {
|
|
10
|
+
return jwt;
|
|
11
|
+
}
|
|
12
|
+
jwt = req.cookies?.get(descopeSdk.SessionTokenCookieName)?.value;
|
|
13
|
+
if (jwt) {
|
|
14
|
+
return jwt;
|
|
15
|
+
}
|
|
16
|
+
return undefined;
|
|
17
|
+
};
|
|
18
|
+
const defaultPublicRoutes = {
|
|
19
|
+
signIn: process.env.SIGN_IN_ROUTE || '/sign-in',
|
|
20
|
+
signUp: process.env.SIGN_UP_ROUTE || '/sign-up'
|
|
21
|
+
};
|
|
22
|
+
const isPublicRoute = (req, options) => {
|
|
23
|
+
const isDefaultPublicRoute = Object.values(defaultPublicRoutes).includes(req.nextUrl.pathname);
|
|
24
|
+
const isPublic = options.publicRoutes?.includes(req.nextUrl.pathname);
|
|
25
|
+
return isDefaultPublicRoute || isPublic;
|
|
26
|
+
};
|
|
27
|
+
const addSessionToHeadersIfExists = (headers, session) => {
|
|
28
|
+
if (session) {
|
|
29
|
+
const requestHeaders = new Headers(headers);
|
|
30
|
+
requestHeaders.set(DESCOPE_SESSION_HEADER, Buffer.from(JSON.stringify(session)).toString('base64'));
|
|
31
|
+
return requestHeaders;
|
|
32
|
+
}
|
|
33
|
+
return headers;
|
|
34
|
+
};
|
|
35
|
+
// returns a Middleware that checks if the user is authenticated
|
|
36
|
+
// if the user is not authenticated, it redirects to the redirectUrl
|
|
37
|
+
// if the user is authenticated, it adds the session to the headers
|
|
38
|
+
const createAuthMiddleware = (options = {}) => async (req) => {
|
|
39
|
+
console.debug('Auth middleware starts');
|
|
40
|
+
const jwt = getSessionJwt(req);
|
|
41
|
+
// check if the user is authenticated
|
|
42
|
+
let session;
|
|
43
|
+
try {
|
|
44
|
+
session = await getGlobalSdk({
|
|
45
|
+
projectId: options.projectId
|
|
46
|
+
}).validateJwt(jwt);
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
console.debug('Auth middleware, Failed to validate JWT', err);
|
|
50
|
+
if (!isPublicRoute(req, options)) {
|
|
51
|
+
const defaultRedirectUrl = options.redirectUrl || defaultPublicRoutes.signIn;
|
|
52
|
+
const url = req.nextUrl.clone();
|
|
53
|
+
url.pathname = defaultRedirectUrl;
|
|
54
|
+
console.debug(`Auth middleware, Redirecting to ${url}`);
|
|
55
|
+
return NextResponse.redirect(url);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
console.debug('Auth middleware finishes');
|
|
59
|
+
// add the session to the request, if it exists
|
|
60
|
+
const headers = addSessionToHeadersIfExists(req.headers, session);
|
|
61
|
+
return NextResponse.next({
|
|
62
|
+
request: {
|
|
63
|
+
headers
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export { createAuthMiddleware as default };
|
|
69
|
+
//# sourceMappingURL=authMiddleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authMiddleware.js","sources":["../../src/server/authMiddleware.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport { NextRequest, NextResponse } from 'next/server';\nimport descopeSdk from '@descope/node-sdk';\nimport type { AuthenticationInfo } from '@descope/node-sdk';\nimport { DESCOPE_SESSION_HEADER } from './constants';\nimport { getGlobalSdk } from './sdk';\n\ntype MiddlewareOptions = {\n\t// The Descope project ID to use for authentication\n\t// Defaults to process.env.DESCOPE_PROJECT_ID\n\tprojectId?: string;\n\n\t// The URL to redirect to if the user is not authenticated\n\t// Defaults to process.env.SIGN_IN_ROUTE or '/sign-in' if not provided\n\tredirectUrl?: string;\n\n\t// An array of public routes that do not require authentication\n\t// In addition to the default public routes:\n\t// - process.env.SIGN_IN_ROUTE or /sign-in if not provided\n\t// - process.env.SIGN_UP_ROUTE or /sign-up if not provided\n\tpublicRoutes?: string[];\n};\n\nconst getSessionJwt = (req: NextRequest): string | undefined => {\n\tlet jwt = req.headers?.get('Authorization')?.split(' ')[1];\n\tif (jwt) {\n\t\treturn jwt;\n\t}\n\n\tjwt = req.cookies?.get(descopeSdk.SessionTokenCookieName)?.value;\n\tif (jwt) {\n\t\treturn jwt;\n\t}\n\treturn undefined;\n};\n\nconst defaultPublicRoutes = {\n\tsignIn: process.env.SIGN_IN_ROUTE || '/sign-in',\n\tsignUp: process.env.SIGN_UP_ROUTE || '/sign-up'\n};\n\nconst isPublicRoute = (req: NextRequest, options: MiddlewareOptions) => {\n\tconst isDefaultPublicRoute = Object.values(defaultPublicRoutes).includes(\n\t\treq.nextUrl.pathname\n\t);\n\tconst isPublic = options.publicRoutes?.includes(req.nextUrl.pathname);\n\n\treturn isDefaultPublicRoute || isPublic;\n};\n\nconst addSessionToHeadersIfExists = (\n\theaders: Headers,\n\tsession: AuthenticationInfo | undefined\n): Headers => {\n\tif (session) {\n\t\tconst requestHeaders = new Headers(headers);\n\t\trequestHeaders.set(\n\t\t\tDESCOPE_SESSION_HEADER,\n\t\t\tBuffer.from(JSON.stringify(session)).toString('base64')\n\t\t);\n\t\treturn requestHeaders;\n\t}\n\treturn headers;\n};\n\n// returns a Middleware that checks if the user is authenticated\n// if the user is not authenticated, it redirects to the redirectUrl\n// if the user is authenticated, it adds the session to the headers\nconst createAuthMiddleware =\n\t(options: MiddlewareOptions = {}) =>\n\tasync (req: NextRequest) => {\n\t\tconsole.debug('Auth middleware starts');\n\n\t\tconst jwt = getSessionJwt(req);\n\n\t\t// check if the user is authenticated\n\t\tlet session: AuthenticationInfo | undefined;\n\t\ttry {\n\t\t\tsession = await getGlobalSdk({\n\t\t\t\tprojectId: options.projectId\n\t\t\t}).validateJwt(jwt);\n\t\t} catch (err) {\n\t\t\tconsole.debug('Auth middleware, Failed to validate JWT', err);\n\t\t\tif (!isPublicRoute(req, options)) {\n\t\t\t\tconst defaultRedirectUrl =\n\t\t\t\t\toptions.redirectUrl || defaultPublicRoutes.signIn;\n\t\t\t\tconst url = req.nextUrl.clone();\n\t\t\t\turl.pathname = defaultRedirectUrl;\n\t\t\t\tconsole.debug(`Auth middleware, Redirecting to ${url}`);\n\t\t\t\treturn NextResponse.redirect(url);\n\t\t\t}\n\t\t}\n\n\t\tconsole.debug('Auth middleware finishes');\n\t\t// add the session to the request, if it exists\n\t\tconst headers = addSessionToHeadersIfExists(req.headers, session);\n\t\treturn NextResponse.next({\n\t\t\trequest: {\n\t\t\t\theaders\n\t\t\t}\n\t\t});\n\t};\n\nexport default createAuthMiddleware;\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const DESCOPE_SESSION_HEADER = 'x-descope-session';
|
|
2
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
3
|
+
const baseHeaders = {
|
|
4
|
+
'x-descope-sdk-name': 'nextjs',
|
|
5
|
+
'x-descope-sdk-version': "0.0.0-next-3ba7f03f-20240207"
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export { DESCOPE_SESSION_HEADER, baseHeaders };
|
|
9
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../src/server/constants.ts"],"sourcesContent":["// Replaced in build time\ndeclare const BUILD_VERSION: string;\n\nexport const DESCOPE_SESSION_HEADER = 'x-descope-session';\n\n// eslint-disable-next-line import/prefer-default-export\nexport const baseHeaders = {\n\t'x-descope-sdk-name': 'nextjs',\n\t'x-descope-sdk-version': BUILD_VERSION\n};\n"],"names":[],"mappings":"AAGO,MAAM,sBAAsB,GAAG,oBAAoB;AAE1D;AACa,MAAA,WAAW,GAAG;AAC1B,IAAA,oBAAoB,EAAE,QAAQ;AAC9B,IAAA,uBAAuB,EAAE,8BAAa;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useDescope, useSession, useUser, getSessionToken, getRefreshToken, getJwtPermissions, getJwtRoles, refresh } from '@descope/react-sdk';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './shared';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
type MiddlewareOptions = {
|
|
3
|
+
projectId?: string;
|
|
4
|
+
redirectUrl?: string;
|
|
5
|
+
publicRoutes?: string[];
|
|
6
|
+
};
|
|
7
|
+
declare const createAuthMiddleware: (options?: MiddlewareOptions) => (req: NextRequest) => Promise<NextResponse<unknown>>;
|
|
8
|
+
export default createAuthMiddleware;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import descopeSdk from '@descope/node-sdk';
|
|
2
|
+
type Sdk = ReturnType<typeof descopeSdk>;
|
|
3
|
+
type CreateSdkParams = Omit<Parameters<typeof descopeSdk>[0], 'projectId'> & {
|
|
4
|
+
projectId?: string | undefined;
|
|
5
|
+
};
|
|
6
|
+
export declare const createSdk: (config?: CreateSdkParams) => Sdk;
|
|
7
|
+
export declare const getGlobalSdk: (config?: Pick<CreateSdkParams, 'projectId'>) => Sdk;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type AdditionalProps = {
|
|
3
|
+
redirectAfterSuccess?: string;
|
|
4
|
+
redirectAfterError?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const Descope: React.ComponentType<(({
|
|
7
|
+
flowId: string;
|
|
8
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
9
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
10
|
+
logger?: import("@descope/web-component").ILogger;
|
|
11
|
+
tenant?: string;
|
|
12
|
+
theme?: import("@descope/web-component").ThemeOptions;
|
|
13
|
+
locale?: string;
|
|
14
|
+
autoFocus?: import("@descope/web-component").AutoFocusOptions;
|
|
15
|
+
debug?: boolean;
|
|
16
|
+
telemetryKey?: string;
|
|
17
|
+
redirectUrl?: string;
|
|
18
|
+
errorTransformer?: (error: {
|
|
19
|
+
text: string;
|
|
20
|
+
type: string;
|
|
21
|
+
}) => string;
|
|
22
|
+
form?: Record<string, any>;
|
|
23
|
+
client?: Record<string, any>;
|
|
24
|
+
} & React.RefAttributes<HTMLElement>) | ({
|
|
25
|
+
flowId: string;
|
|
26
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
27
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
28
|
+
logger?: import("@descope/web-component").ILogger;
|
|
29
|
+
tenant?: string;
|
|
30
|
+
theme?: import("@descope/web-component").ThemeOptions;
|
|
31
|
+
locale?: string;
|
|
32
|
+
autoFocus?: import("@descope/web-component").AutoFocusOptions;
|
|
33
|
+
debug?: boolean;
|
|
34
|
+
telemetryKey?: string;
|
|
35
|
+
redirectUrl?: string;
|
|
36
|
+
errorTransformer?: (error: {
|
|
37
|
+
text: string;
|
|
38
|
+
type: string;
|
|
39
|
+
}) => string;
|
|
40
|
+
form?: Record<string, any>;
|
|
41
|
+
client?: Record<string, any>;
|
|
42
|
+
} & React.RefAttributes<HTMLElement> & {
|
|
43
|
+
children?: React.ReactNode;
|
|
44
|
+
})) & AdditionalProps>;
|
|
45
|
+
export declare const SignInFlow: React.ComponentType<({
|
|
46
|
+
form?: Record<string, any>;
|
|
47
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
48
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
49
|
+
logger?: import("@descope/web-component").ILogger;
|
|
50
|
+
tenant?: string;
|
|
51
|
+
theme?: import("@descope/web-component").ThemeOptions;
|
|
52
|
+
locale?: string;
|
|
53
|
+
autoFocus?: import("@descope/web-component").AutoFocusOptions;
|
|
54
|
+
debug?: boolean;
|
|
55
|
+
telemetryKey?: string;
|
|
56
|
+
redirectUrl?: string;
|
|
57
|
+
errorTransformer?: (error: {
|
|
58
|
+
text: string;
|
|
59
|
+
type: string;
|
|
60
|
+
}) => string;
|
|
61
|
+
client?: Record<string, any>;
|
|
62
|
+
} | ({
|
|
63
|
+
form?: Record<string, any>;
|
|
64
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
65
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
66
|
+
logger?: import("@descope/web-component").ILogger;
|
|
67
|
+
tenant?: string;
|
|
68
|
+
theme?: import("@descope/web-component").ThemeOptions;
|
|
69
|
+
locale?: string;
|
|
70
|
+
autoFocus?: import("@descope/web-component").AutoFocusOptions;
|
|
71
|
+
debug?: boolean;
|
|
72
|
+
telemetryKey?: string;
|
|
73
|
+
redirectUrl?: string;
|
|
74
|
+
errorTransformer?: (error: {
|
|
75
|
+
text: string;
|
|
76
|
+
type: string;
|
|
77
|
+
}) => string;
|
|
78
|
+
client?: Record<string, any>;
|
|
79
|
+
} & {
|
|
80
|
+
children?: React.ReactNode;
|
|
81
|
+
})) & AdditionalProps>;
|
|
82
|
+
export declare const SignUpFlow: React.ComponentType<({
|
|
83
|
+
form?: Record<string, any>;
|
|
84
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
85
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
86
|
+
logger?: import("@descope/web-component").ILogger;
|
|
87
|
+
tenant?: string;
|
|
88
|
+
theme?: import("@descope/web-component").ThemeOptions;
|
|
89
|
+
locale?: string;
|
|
90
|
+
autoFocus?: import("@descope/web-component").AutoFocusOptions;
|
|
91
|
+
debug?: boolean;
|
|
92
|
+
telemetryKey?: string;
|
|
93
|
+
redirectUrl?: string;
|
|
94
|
+
errorTransformer?: (error: {
|
|
95
|
+
text: string;
|
|
96
|
+
type: string;
|
|
97
|
+
}) => string;
|
|
98
|
+
client?: Record<string, any>;
|
|
99
|
+
} | ({
|
|
100
|
+
form?: Record<string, any>;
|
|
101
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
102
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
103
|
+
logger?: import("@descope/web-component").ILogger;
|
|
104
|
+
tenant?: string;
|
|
105
|
+
theme?: import("@descope/web-component").ThemeOptions;
|
|
106
|
+
locale?: string;
|
|
107
|
+
autoFocus?: import("@descope/web-component").AutoFocusOptions;
|
|
108
|
+
debug?: boolean;
|
|
109
|
+
telemetryKey?: string;
|
|
110
|
+
redirectUrl?: string;
|
|
111
|
+
errorTransformer?: (error: {
|
|
112
|
+
text: string;
|
|
113
|
+
type: string;
|
|
114
|
+
}) => string;
|
|
115
|
+
client?: Record<string, any>;
|
|
116
|
+
} & {
|
|
117
|
+
children?: React.ReactNode;
|
|
118
|
+
})) & AdditionalProps>;
|
|
119
|
+
export declare const SignUpOrInFlow: React.ComponentType<({
|
|
120
|
+
form?: Record<string, any>;
|
|
121
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
122
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
123
|
+
logger?: import("@descope/web-component").ILogger;
|
|
124
|
+
tenant?: string;
|
|
125
|
+
theme?: import("@descope/web-component").ThemeOptions;
|
|
126
|
+
locale?: string;
|
|
127
|
+
autoFocus?: import("@descope/web-component").AutoFocusOptions;
|
|
128
|
+
debug?: boolean;
|
|
129
|
+
telemetryKey?: string;
|
|
130
|
+
redirectUrl?: string;
|
|
131
|
+
errorTransformer?: (error: {
|
|
132
|
+
text: string;
|
|
133
|
+
type: string;
|
|
134
|
+
}) => string;
|
|
135
|
+
client?: Record<string, any>;
|
|
136
|
+
} | ({
|
|
137
|
+
form?: Record<string, any>;
|
|
138
|
+
onSuccess?: (event: CustomEvent<any>) => void;
|
|
139
|
+
onError?: OnErrorEventHandlerNonNull & ((event: CustomEvent<any>) => void);
|
|
140
|
+
logger?: import("@descope/web-component").ILogger;
|
|
141
|
+
tenant?: string;
|
|
142
|
+
theme?: import("@descope/web-component").ThemeOptions;
|
|
143
|
+
locale?: string;
|
|
144
|
+
autoFocus?: import("@descope/web-component").AutoFocusOptions;
|
|
145
|
+
debug?: boolean;
|
|
146
|
+
telemetryKey?: string;
|
|
147
|
+
redirectUrl?: string;
|
|
148
|
+
errorTransformer?: (error: {
|
|
149
|
+
text: string;
|
|
150
|
+
type: string;
|
|
151
|
+
}) => string;
|
|
152
|
+
client?: Record<string, any>;
|
|
153
|
+
} & {
|
|
154
|
+
children?: React.ReactNode;
|
|
155
|
+
})) & AdditionalProps>;
|
|
156
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type TempType = {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
import descopeSdk, { AuthenticationInfo } from '@descope/node-sdk';
|
|
3
|
+
import { NextApiRequest } from 'next';
|
|
4
|
+
|
|
5
|
+
type MiddlewareOptions = {
|
|
6
|
+
projectId?: string;
|
|
7
|
+
redirectUrl?: string;
|
|
8
|
+
publicRoutes?: string[];
|
|
9
|
+
};
|
|
10
|
+
declare const createAuthMiddleware: (options?: MiddlewareOptions) => (req: NextRequest) => Promise<NextResponse<unknown>>;
|
|
11
|
+
|
|
12
|
+
declare const session: () => AuthenticationInfo | undefined;
|
|
13
|
+
declare const getSession: (req: NextApiRequest) => AuthenticationInfo | undefined;
|
|
14
|
+
|
|
15
|
+
type Sdk = ReturnType<typeof descopeSdk>;
|
|
16
|
+
type CreateSdkParams = Omit<Parameters<typeof descopeSdk>[0], 'projectId'> & {
|
|
17
|
+
projectId?: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
declare const createSdk: (config?: CreateSdkParams) => Sdk;
|
|
20
|
+
|
|
21
|
+
export { createAuthMiddleware as authMiddleware, createSdk, getSession, session };
|