@asgardeo/nextjs 0.0.1
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 +201 -0
- package/README.md +87 -0
- package/dist/AsgardeoNextClient.d.ts +40 -0
- package/dist/AsgardeoNextClient.js +138 -0
- package/dist/AsgardeoNextClient.js.map +1 -0
- package/dist/cjs/index.js +67 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/client/components/actions/SignInButton.d.ts +41 -0
- package/dist/client/components/actions/SignInButton.js +42 -0
- package/dist/client/components/actions/SignInButton.js.map +1 -0
- package/dist/client/components/actions/SignOutButton.d.ts +41 -0
- package/dist/client/components/actions/SignOutButton.js +42 -0
- package/dist/client/components/actions/SignOutButton.js.map +1 -0
- package/dist/client/components/actions/SignUpButton.d.ts +41 -0
- package/dist/client/components/actions/SignUpButton.js +42 -0
- package/dist/client/components/actions/SignUpButton.js.map +1 -0
- package/dist/client/components/control/SignedIn.d.ts +45 -0
- package/dist/client/components/control/SignedIn.js +56 -0
- package/dist/client/components/control/SignedIn.js.map +1 -0
- package/dist/client/components/control/SignedOut.d.ts +45 -0
- package/dist/client/components/control/SignedOut.js +56 -0
- package/dist/client/components/control/SignedOut.js.map +1 -0
- package/dist/client/contexts/AsgardeoContext.d.ts +28 -0
- package/dist/client/contexts/AsgardeoContext.js +26 -0
- package/dist/client/contexts/AsgardeoContext.js.map +1 -0
- package/dist/client/hooks/useAsgardeo.d.ts +20 -0
- package/dist/client/hooks/useAsgardeo.js +29 -0
- package/dist/client/hooks/useAsgardeo.js.map +1 -0
- package/dist/client/providers/AsgardeoProvider.d.ts +24 -0
- package/dist/client/providers/AsgardeoProvider.js +23 -0
- package/dist/client/providers/AsgardeoProvider.js.map +1 -0
- package/dist/configs/InternalAuthAPIRoutesConfig.d.ts +20 -0
- package/dist/configs/InternalAuthAPIRoutesConfig.js +25 -0
- package/dist/configs/InternalAuthAPIRoutesConfig.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/models/api.d.ts +43 -0
- package/dist/models/api.js +19 -0
- package/dist/models/api.js.map +1 -0
- package/dist/models/config.d.ts +30 -0
- package/dist/models/config.js +19 -0
- package/dist/models/config.js.map +1 -0
- package/dist/server/AsgardeoProvider.d.ts +40 -0
- package/dist/server/AsgardeoProvider.js +20 -0
- package/dist/server/AsgardeoProvider.js.map +1 -0
- package/dist/server/actions/deleteSessionId.d.ts +19 -0
- package/dist/server/actions/deleteSessionId.js +26 -0
- package/dist/server/actions/deleteSessionId.js.map +1 -0
- package/dist/server/actions/getSessionId.d.ts +19 -0
- package/dist/server/actions/getSessionId.js +26 -0
- package/dist/server/actions/getSessionId.js.map +1 -0
- package/dist/server/actions/isSignedIn.d.ts +19 -0
- package/dist/server/actions/isSignedIn.js +26 -0
- package/dist/server/actions/isSignedIn.js.map +1 -0
- package/dist/server/actions/setSessionId.d.ts +19 -0
- package/dist/server/actions/setSessionId.js +43 -0
- package/dist/server/actions/setSessionId.js.map +1 -0
- package/dist/utils/decorateConfigWithNextEnv.d.ts +20 -0
- package/dist/utils/decorateConfigWithNextEnv.js +28 -0
- package/dist/utils/decorateConfigWithNextEnv.js.map +1 -0
- package/package.json +70 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export { default as AsgardeoProvider } from './server/AsgardeoProvider';
|
|
19
|
+
export * from './server/AsgardeoProvider';
|
|
20
|
+
export { default as isSignedIn } from './server/actions/isSignedIn';
|
|
21
|
+
export { default as SignedIn } from './client/components/control/SignedIn';
|
|
22
|
+
export * from './client/components/control/SignedIn';
|
|
23
|
+
export { default as SignedOut } from './client/components/control/SignedOut';
|
|
24
|
+
export * from './client/components/control/SignedOut';
|
|
25
|
+
export { default as SignInButton } from './client/components/actions/SignInButton';
|
|
26
|
+
export { default as SignOutButton } from './client/components/actions/SignOutButton';
|
|
27
|
+
export { default as AsgardeoContext } from './client/contexts/AsgardeoContext';
|
|
28
|
+
export { default as AsgardeoNext } from './AsgardeoNextClient';
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AACtE,cAAc,2BAA2B,CAAC;AAE1C,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,MAAM,6BAA6B,CAAC;AAElE,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,sCAAsC,CAAC;AACzE,cAAc,sCAAsC,CAAC;AAErD,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,uCAAuC,CAAC;AAC3E,cAAc,uCAAuC,CAAC;AAEtD,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,0CAA0C,CAAC;AAGjF,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,2CAA2C,CAAC;AAGnF,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,mCAAmC,CAAC;AAG7E,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Interface defining the internal API routes for authentication.
|
|
20
|
+
* These routes are used internally by the Asgardeo Next.js SDK for handling authentication flows.
|
|
21
|
+
*/
|
|
22
|
+
export interface InternalAuthAPIRoutes {
|
|
23
|
+
/**
|
|
24
|
+
* Route for handling session management.
|
|
25
|
+
* This route should return the current signed-in status.
|
|
26
|
+
*/
|
|
27
|
+
session: string;
|
|
28
|
+
/**
|
|
29
|
+
* Route for handling sign-in requests.
|
|
30
|
+
* This route should handle the sign-in flow and redirect users to the appropriate authentication endpoint.
|
|
31
|
+
*/
|
|
32
|
+
signIn: string;
|
|
33
|
+
/**
|
|
34
|
+
* Route for handling sign-out requests.
|
|
35
|
+
* This route should handle the sign-out flow and clean up any authentication state.
|
|
36
|
+
*/
|
|
37
|
+
signOut: string;
|
|
38
|
+
/**
|
|
39
|
+
* Route for handling sign-up requests.
|
|
40
|
+
* This route should handle the sign-up flow and redirect users to the appropriate registration endpoint.
|
|
41
|
+
*/
|
|
42
|
+
signUp?: string;
|
|
43
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/models/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { AsgardeoNodeConfig } from '@asgardeo/node';
|
|
19
|
+
/**
|
|
20
|
+
* Configuration type for the Asgardeo Next.js SDK.
|
|
21
|
+
* Extends AsgardeoNodeConfig to provide Next.js-specific authentication configuration.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* Configuration options include:
|
|
25
|
+
* - Authentication endpoints and parameters
|
|
26
|
+
* - Next.js specific redirects and middleware settings
|
|
27
|
+
* - Session configuration for Next.js apps
|
|
28
|
+
* - Environment variable integration
|
|
29
|
+
*/
|
|
30
|
+
export type AsgardeoNextConfig = AsgardeoNodeConfig;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/models/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { FC, PropsWithChildren } from 'react';
|
|
19
|
+
import { AsgardeoClientProviderProps } from '../client/providers/AsgardeoProvider';
|
|
20
|
+
/**
|
|
21
|
+
* Props interface of {@link AsgardeoServerProvider}
|
|
22
|
+
*/
|
|
23
|
+
export type AsgardeoServerProviderProps = AsgardeoClientProviderProps;
|
|
24
|
+
/**
|
|
25
|
+
* Server-side provider component for Asgardeo authentication.
|
|
26
|
+
* Wraps the client-side provider and handles server-side authentication logic.
|
|
27
|
+
*
|
|
28
|
+
* @param props - Props injected into the component.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <AsgardeoServerProvider>
|
|
33
|
+
* <YourApp />
|
|
34
|
+
* </AsgardeoServerProvider>
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @returns AsgardeoServerProvider component.
|
|
38
|
+
*/
|
|
39
|
+
declare const AsgardeoServerProvider: FC<PropsWithChildren<AsgardeoServerProviderProps>>;
|
|
40
|
+
export default AsgardeoServerProvider;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import AsgardeoClientProvider from '../client/providers/AsgardeoProvider';
|
|
3
|
+
/**
|
|
4
|
+
* Server-side provider component for Asgardeo authentication.
|
|
5
|
+
* Wraps the client-side provider and handles server-side authentication logic.
|
|
6
|
+
*
|
|
7
|
+
* @param props - Props injected into the component.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <AsgardeoServerProvider>
|
|
12
|
+
* <YourApp />
|
|
13
|
+
* </AsgardeoServerProvider>
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @returns AsgardeoServerProvider component.
|
|
17
|
+
*/
|
|
18
|
+
const AsgardeoServerProvider = ({ children, }) => (_jsx(AsgardeoClientProvider, { children: children }));
|
|
19
|
+
export default AsgardeoServerProvider;
|
|
20
|
+
//# sourceMappingURL=AsgardeoProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AsgardeoProvider.js","sourceRoot":"","sources":["../../src/server/AsgardeoProvider.tsx"],"names":[],"mappings":";AAmBA,OAAO,sBAAqD,MAAM,sCAAsC,CAAC;AAOzG;;;;;;;;;;;;;;GAcG;AACH,MAAM,sBAAsB,GAAuD,CAAC,EAClF,QAAQ,GACuC,EAAgB,EAAE,CAAC,CAClE,KAAC,sBAAsB,cAAE,QAAQ,GAA0B,CAC5D,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
declare const deleteSessionId: () => Promise<void>;
|
|
19
|
+
export default deleteSessionId;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
'use server';
|
|
19
|
+
import { CookieConfig } from '@asgardeo/node';
|
|
20
|
+
import { cookies } from 'next/headers';
|
|
21
|
+
const deleteSessionId = async () => {
|
|
22
|
+
const cookieStore = await cookies();
|
|
23
|
+
await cookieStore.delete(CookieConfig.SESSION_COOKIE_NAME);
|
|
24
|
+
};
|
|
25
|
+
export default deleteSessionId;
|
|
26
|
+
//# sourceMappingURL=deleteSessionId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteSessionId.js","sourceRoot":"","sources":["../../../src/server/actions/deleteSessionId.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;AAEb,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAErC,MAAM,eAAe,GAAG,KAAK,IAAmB,EAAE;IAChD,MAAM,WAAW,GAA2B,MAAM,OAAO,EAAE,CAAC;IAE5D,MAAM,WAAW,CAAC,MAAM,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;AAC7D,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
declare const getSessionId: () => Promise<string | undefined>;
|
|
19
|
+
export default getSessionId;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
'use server';
|
|
19
|
+
import { CookieConfig } from '@asgardeo/node';
|
|
20
|
+
import { cookies } from 'next/headers';
|
|
21
|
+
const getSessionId = async () => {
|
|
22
|
+
const cookieStore = await cookies();
|
|
23
|
+
return cookieStore.get(CookieConfig.SESSION_COOKIE_NAME)?.value;
|
|
24
|
+
};
|
|
25
|
+
export default getSessionId;
|
|
26
|
+
//# sourceMappingURL=getSessionId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSessionId.js","sourceRoot":"","sources":["../../../src/server/actions/getSessionId.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;AAEb,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAErC,MAAM,YAAY,GAAG,KAAK,IAAiC,EAAE;IAC3D,MAAM,WAAW,GAA2B,MAAM,OAAO,EAAE,CAAC;IAE5D,OAAO,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,mBAAmB,CAAC,EAAE,KAAK,CAAC;AAClE,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
declare const isSignedIn: () => Promise<boolean>;
|
|
19
|
+
export default isSignedIn;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
'use server';
|
|
19
|
+
import { CookieConfig } from '@asgardeo/node';
|
|
20
|
+
import { cookies } from 'next/headers';
|
|
21
|
+
const isSignedIn = async () => {
|
|
22
|
+
const cookieStore = await cookies();
|
|
23
|
+
return !!cookieStore.get(CookieConfig.SESSION_COOKIE_NAME)?.value;
|
|
24
|
+
};
|
|
25
|
+
export default isSignedIn;
|
|
26
|
+
//# sourceMappingURL=isSignedIn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isSignedIn.js","sourceRoot":"","sources":["../../../src/server/actions/isSignedIn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;AAEb,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAErC,MAAM,UAAU,GAAG,KAAK,IAAsB,EAAE;IAC9C,MAAM,WAAW,GAA2B,MAAM,OAAO,EAAE,CAAC;IAE5D,OAAO,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,mBAAmB,CAAC,EAAE,KAAK,CAAC;AACpE,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
declare const setSessionId: (sessionId?: string) => Promise<string>;
|
|
19
|
+
export default setSessionId;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
'use server';
|
|
19
|
+
import { CookieConfig, generateSessionId } from '@asgardeo/node';
|
|
20
|
+
import { cookies } from 'next/headers';
|
|
21
|
+
const setSessionId = async (sessionId) => {
|
|
22
|
+
const cookieStore = await cookies();
|
|
23
|
+
const sessionCookie = cookieStore.get(CookieConfig.SESSION_COOKIE_NAME);
|
|
24
|
+
let sessionCookieValue = sessionId;
|
|
25
|
+
if (!sessionCookieValue && sessionCookie) {
|
|
26
|
+
sessionCookieValue = sessionCookie.value;
|
|
27
|
+
}
|
|
28
|
+
else if (sessionCookie) {
|
|
29
|
+
sessionCookieValue = sessionCookie.value;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
sessionCookieValue = generateSessionId();
|
|
33
|
+
}
|
|
34
|
+
cookieStore.set(CookieConfig.SESSION_COOKIE_NAME, sessionCookieValue, {
|
|
35
|
+
httpOnly: CookieConfig?.DEFAULT_HTTP_ONLY,
|
|
36
|
+
maxAge: CookieConfig?.DEFAULT_MAX_AGE,
|
|
37
|
+
sameSite: CookieConfig?.DEFAULT_SAME_SITE,
|
|
38
|
+
secure: CookieConfig?.DEFAULT_SECURE,
|
|
39
|
+
});
|
|
40
|
+
return Promise.resolve(sessionCookieValue);
|
|
41
|
+
};
|
|
42
|
+
export default setSessionId;
|
|
43
|
+
//# sourceMappingURL=setSessionId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setSessionId.js","sourceRoot":"","sources":["../../../src/server/actions/setSessionId.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;AAEb,OAAO,EAAC,YAAY,EAAE,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AAG/D,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAErC,MAAM,YAAY,GAAG,KAAK,EAAE,SAAkB,EAAmB,EAAE;IACjE,MAAM,WAAW,GAA2B,MAAM,OAAO,EAAE,CAAC;IAE5D,MAAM,aAAa,GAA8B,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;IACnG,IAAI,kBAAkB,GAAuB,SAAS,CAAC;IAEvD,IAAI,CAAC,kBAAkB,IAAI,aAAa,EAAE,CAAC;QACzC,kBAAkB,GAAG,aAAa,CAAC,KAAK,CAAC;IAC3C,CAAC;SAAM,IAAI,aAAa,EAAE,CAAC;QACzB,kBAAkB,GAAG,aAAa,CAAC,KAAK,CAAC;IAC3C,CAAC;SAAM,CAAC;QACN,kBAAkB,GAAG,iBAAiB,EAAE,CAAC;IAC3C,CAAC;IAED,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,mBAAmB,EAAE,kBAA4B,EAAE;QAC9E,QAAQ,EAAE,YAAY,EAAE,iBAAiB;QACzC,MAAM,EAAE,YAAY,EAAE,eAAe;QACrC,QAAQ,EAAE,YAAY,EAAE,iBAAiB;QACzC,MAAM,EAAE,YAAY,EAAE,cAAc;KACrC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC7C,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { AsgardeoNextConfig } from '../models/config';
|
|
19
|
+
declare const decorateConfigWithNextEnv: (config: AsgardeoNextConfig) => AsgardeoNextConfig;
|
|
20
|
+
export default decorateConfigWithNextEnv;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
const decorateConfigWithNextEnv = (config) => {
|
|
19
|
+
const { baseUrl, clientId, clientSecret, ...rest } = config;
|
|
20
|
+
return {
|
|
21
|
+
...rest,
|
|
22
|
+
baseUrl: baseUrl || process.env['NEXT_PUBLIC_ASGARDEO_BASE_URL'],
|
|
23
|
+
clientId: clientId || process.env['NEXT_PUBLIC_ASGARDEO_CLIENT_ID'],
|
|
24
|
+
clientSecret: clientSecret || process.env['ASGARDEO_CLIENT_SECRET'],
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export default decorateConfigWithNextEnv;
|
|
28
|
+
//# sourceMappingURL=decorateConfigWithNextEnv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorateConfigWithNextEnv.js","sourceRoot":"","sources":["../../src/utils/decorateConfigWithNextEnv.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,MAAM,yBAAyB,GAAG,CAAC,MAA0B,EAAsB,EAAE;IACnF,MAAM,EAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,IAAI,EAAC,GAAG,MAAM,CAAC;IAE1D,OAAO;QACL,GAAG,IAAI;QACP,OAAO,EAAE,OAAO,IAAK,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAY;QAC5E,QAAQ,EAAE,QAAQ,IAAK,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAY;QAC/E,YAAY,EAAE,YAAY,IAAK,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAY;KAChF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@asgardeo/nextjs",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Next.js implementation of Asgardeo JavaScript SDK.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"asgardeo",
|
|
7
|
+
"next.js",
|
|
8
|
+
"react",
|
|
9
|
+
"ssr"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://github.com/asgardeo/javascript/tree/main/packages/next#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/asgardeo/javascript/issues"
|
|
14
|
+
},
|
|
15
|
+
"author": "WSO2",
|
|
16
|
+
"license": "Apache-2.0",
|
|
17
|
+
"type": "module",
|
|
18
|
+
"main": "dist/index.js",
|
|
19
|
+
"module": "dist/index.js",
|
|
20
|
+
"commonjs": "dist/cjs/index.js",
|
|
21
|
+
"exports": {
|
|
22
|
+
"import": "./dist/index.js",
|
|
23
|
+
"require": "./dist/cjs/index.js"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"README.md",
|
|
28
|
+
"LICENSE"
|
|
29
|
+
],
|
|
30
|
+
"types": "dist/index.d.ts",
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/asgardeo/javascript",
|
|
34
|
+
"directory": "packages/next"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@types/react": "^19.1.4",
|
|
38
|
+
"tslib": "^2.8.1",
|
|
39
|
+
"@asgardeo/node": "^0.0.1",
|
|
40
|
+
"@asgardeo/react": "^0.3.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^22.15.3",
|
|
44
|
+
"@wso2/eslint-plugin": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/eslint-plugin?a1fc6eb570653c999828aea9f5027cba06af4391",
|
|
45
|
+
"@wso2/prettier-config": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/prettier-config?a1fc6eb570653c999828aea9f5027cba06af4391",
|
|
46
|
+
"esbuild": "^0.25.4",
|
|
47
|
+
"esbuild-plugin-preserve-directives": "^0.0.11",
|
|
48
|
+
"eslint": "8.57.0",
|
|
49
|
+
"next": "^15.3.2",
|
|
50
|
+
"prettier": "^2.6.2",
|
|
51
|
+
"rimraf": "^6.0.1",
|
|
52
|
+
"react": "^19.1.0",
|
|
53
|
+
"typescript": "~5.7.2",
|
|
54
|
+
"vitest": "^3.1.3"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"next": ">=13",
|
|
58
|
+
"react": ">=16.8.0"
|
|
59
|
+
},
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"access": "public"
|
|
62
|
+
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
"build": "pnpm clean && node esbuild.config.mjs && tsc -p tsconfig.lib.json --outDir dist",
|
|
65
|
+
"clean": "rimraf dist",
|
|
66
|
+
"fix:lint": "eslint . --ext .js,.jsx,.ts,.tsx,.cjs,.mjs",
|
|
67
|
+
"lint": "eslint . --ext .js,.jsx,.ts,.tsx,.cjs,.mjs",
|
|
68
|
+
"test": "vitest"
|
|
69
|
+
}
|
|
70
|
+
}
|