@asgardeo/nextjs 0.0.2 → 0.1.0

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.
Files changed (76) hide show
  1. package/README.md +68 -8
  2. package/dist/AsgardeoNextClient.d.ts +44 -9
  3. package/dist/AsgardeoNextClient.js +178 -85
  4. package/dist/AsgardeoNextClient.js.map +1 -1
  5. package/dist/cjs/index.js +28 -2
  6. package/dist/cjs/index.js.map +2 -2
  7. package/dist/client/components/actions/SignInButton/SignInButton.d.ts +2 -2
  8. package/dist/client/components/actions/SignInButton/SignInButton.js +34 -7
  9. package/dist/client/components/actions/SignInButton/SignInButton.js.map +1 -1
  10. package/dist/client/components/actions/SignOutButton/SignOutButton.d.ts +1 -2
  11. package/dist/client/components/actions/SignOutButton/SignOutButton.js +25 -4
  12. package/dist/client/components/actions/SignOutButton/SignOutButton.js.map +1 -1
  13. package/dist/client/components/actions/SignUpButton/SignUpButton.d.ts +38 -14
  14. package/dist/client/components/actions/SignUpButton/SignUpButton.js +69 -15
  15. package/dist/client/components/actions/SignUpButton/SignUpButton.js.map +1 -1
  16. package/dist/client/components/control/SignedIn/SignedIn.js +3 -17
  17. package/dist/client/components/control/SignedIn/SignedIn.js.map +1 -1
  18. package/dist/client/components/control/SignedOut/SignedOut.js +3 -17
  19. package/dist/client/components/control/SignedOut/SignedOut.js.map +1 -1
  20. package/dist/client/components/presentation/SignIn/SignIn.d.ts +69 -0
  21. package/dist/client/components/presentation/SignIn/SignIn.js +85 -0
  22. package/dist/client/components/presentation/SignIn/SignIn.js.map +1 -0
  23. package/dist/client/components/presentation/SignUp/SignUp.d.ts +55 -0
  24. package/dist/client/components/presentation/SignUp/SignUp.js +70 -0
  25. package/dist/client/components/presentation/SignUp/SignUp.js.map +1 -0
  26. package/dist/client/components/presentation/UserDropdown/UserDropdown.d.ts +105 -0
  27. package/dist/client/components/presentation/UserDropdown/UserDropdown.js +106 -0
  28. package/dist/client/components/presentation/UserDropdown/UserDropdown.js.map +1 -0
  29. package/dist/client/components/presentation/UserProfile/UserProfile.d.ts +49 -0
  30. package/dist/client/components/presentation/UserProfile/UserProfile.js +57 -0
  31. package/dist/client/components/presentation/UserProfile/UserProfile.js.map +1 -0
  32. package/dist/client/contexts/Asgardeo/AsgardeoContext.d.ts +1 -8
  33. package/dist/client/contexts/Asgardeo/AsgardeoContext.js +13 -1
  34. package/dist/client/contexts/Asgardeo/AsgardeoContext.js.map +1 -1
  35. package/dist/client/contexts/Asgardeo/AsgardeoProvider.d.ts +15 -5
  36. package/dist/client/contexts/Asgardeo/AsgardeoProvider.js +119 -37
  37. package/dist/client/contexts/Asgardeo/AsgardeoProvider.js.map +1 -1
  38. package/dist/index.d.ts +14 -0
  39. package/dist/index.js +9 -0
  40. package/dist/index.js.map +1 -1
  41. package/dist/middleware/asgardeoMiddleware.d.ts +63 -0
  42. package/dist/middleware/asgardeoMiddleware.js +115 -0
  43. package/dist/middleware/asgardeoMiddleware.js.map +1 -0
  44. package/dist/server/AsgardeoProvider.d.ts +6 -3
  45. package/dist/server/AsgardeoProvider.js +42 -3
  46. package/dist/server/AsgardeoProvider.js.map +1 -1
  47. package/dist/server/actions/getClientOrigin.d.ts +2 -0
  48. package/dist/server/actions/getClientOrigin.js +10 -0
  49. package/dist/server/actions/getClientOrigin.js.map +1 -0
  50. package/dist/server/actions/getUserAction.d.ts +35 -0
  51. package/dist/server/actions/getUserAction.js +35 -0
  52. package/dist/server/actions/getUserAction.js.map +1 -0
  53. package/dist/server/actions/getUserProfileAction.d.ts +40 -0
  54. package/dist/server/actions/getUserProfileAction.js +45 -0
  55. package/dist/server/actions/getUserProfileAction.js.map +1 -0
  56. package/dist/server/actions/handleOAuthCallbackAction.d.ts +33 -0
  57. package/dist/server/actions/handleOAuthCallbackAction.js +80 -0
  58. package/dist/server/actions/handleOAuthCallbackAction.js.map +1 -0
  59. package/dist/server/actions/isSignedIn.d.ts +1 -1
  60. package/dist/server/actions/isSignedIn.js +5 -5
  61. package/dist/server/actions/isSignedIn.js.map +1 -1
  62. package/dist/server/actions/signInAction.d.ts +35 -0
  63. package/dist/server/actions/signInAction.js +71 -0
  64. package/dist/server/actions/signInAction.js.map +1 -0
  65. package/dist/server/actions/signOutAction.d.ts +25 -0
  66. package/dist/server/actions/signOutAction.js +33 -0
  67. package/dist/server/actions/signOutAction.js.map +1 -0
  68. package/dist/server/actions/signUpAction.d.ts +35 -0
  69. package/dist/server/actions/signUpAction.js +52 -0
  70. package/dist/server/actions/signUpAction.js.map +1 -0
  71. package/dist/server/actions/updateUserProfileAction.d.ts +36 -0
  72. package/dist/server/actions/updateUserProfileAction.js +41 -0
  73. package/dist/server/actions/updateUserProfileAction.js.map +1 -0
  74. package/dist/utils/decorateConfigWithNextEnv.js +5 -1
  75. package/dist/utils/decorateConfigWithNextEnv.js.map +1 -1
  76. package/package.json +14 -4
@@ -1 +1 @@
1
- {"version":3,"file":"AsgardeoProvider.js","sourceRoot":"","sources":["../../../../src/client/contexts/Asgardeo/AsgardeoProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;;AAEb,OAAO,EAAwB,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC1E,OAAO,EAAC,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAExF,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,2BAA2B,MAAM,8CAA8C,CAAC;AAYvF,MAAM,sBAAsB,GAAuD,CAAC,EAClF,QAAQ,EACR,WAAW,GACoC,EAAE,EAAE;IACnD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAc,IAAI,CAAC,CAAC;IACpD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,Q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AI,MAAM,EAAE,KAAK,EAAE,CAAC;gBAClB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAChC,CAAC;YAED,OAAO,MAAM,EAAE,IAAI,IAAI,MAAM,CAAC;QAChC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,OAAO,CAC1B,GAAG,EAAE,CAAC,CAAC;QACL,OAAO;QACP,IAAI;QACJ,UAAU;QACV,SAAS;QACT,MAAM,EAAE,YAAY;QACpB,OAAO,EAAE,aAAa;QACtB,MAAM,EAAE,YAAY;QACpB,SAAS;QACT,SAAS;KACV,CAAC,EACF,CAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAC7D,CAAC;IAEF,OAAO,CACL,KAAC,eAAe,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YAC3C,KAAC,YAAY,IAAC,WAAW,EAAE,WAAW,EAAE,IAAI,YAC1C,KAAC,aAAa,IAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,YACpG,KAAC,YAAY,cACX,KAAC,YAAY,IAAC,OAAO,EAAE,WAAW,YAAG,QAAQ,GAAgB,GAChD,GACD,GACH,GACU,CAC5B,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -17,15 +17,29 @@
17
17
  */
18
18
  export { default as AsgardeoProvider } from './server/AsgardeoProvider';
19
19
  export * from './server/AsgardeoProvider';
20
+ export { default as useAsgardeo } from './client/contexts/Asgardeo/useAsgardeo';
21
+ export * from './client/contexts/Asgardeo/useAsgardeo';
20
22
  export { default as isSignedIn } from './server/actions/isSignedIn';
23
+ export { default as handleOAuthCallback } from './server/actions/handleOAuthCallbackAction';
21
24
  export { default as SignedIn } from './client/components/control/SignedIn/SignedIn';
22
25
  export { SignedInProps } from './client/components/control/SignedIn/SignedIn';
23
26
  export { default as SignedOut } from './client/components/control/SignedOut/SignedOut';
24
27
  export { SignedOutProps } from './client/components/control/SignedOut/SignedOut';
25
28
  export { default as SignInButton } from './client/components/actions/SignInButton/SignInButton';
26
29
  export type { SignInButtonProps } from './client/components/actions/SignInButton/SignInButton';
30
+ export { default as SignUpButton } from './client/components/actions/SignUpButton/SignUpButton';
31
+ export type { SignUpButtonProps } from './client/components/actions/SignUpButton/SignUpButton';
32
+ export { default as SignIn } from './client/components/presentation/SignIn/SignIn';
33
+ export type { SignInProps } from './client/components/presentation/SignIn/SignIn';
27
34
  export { default as SignOutButton } from './client/components/actions/SignOutButton/SignOutButton';
28
35
  export type { SignOutButtonProps } from './client/components/actions/SignOutButton/SignOutButton';
29
36
  export { default as User } from './client/components/presentation/User/User';
30
37
  export type { UserProps } from './client/components/presentation/User/User';
38
+ export { default as SignUp } from './client/components/presentation/SignUp/SignUp';
39
+ export type { SignUpProps } from './client/components/presentation/SignUp/SignUp';
40
+ export { default as UserDropdown } from './client/components/presentation/UserDropdown/UserDropdown';
41
+ export type { UserDropdownProps } from './client/components/presentation/UserDropdown/UserDropdown';
42
+ export { default as UserProfile } from './client/components/presentation/UserProfile/UserProfile';
43
+ export type { UserProfileProps } from './client/components/presentation/UserProfile/UserProfile';
31
44
  export { default as AsgardeoNext } from './AsgardeoNextClient';
45
+ export { default as asgardeoMiddleware } from './middleware/asgardeoMiddleware';
package/dist/index.js CHANGED
@@ -17,11 +17,20 @@
17
17
  */
18
18
  export { default as AsgardeoProvider } from './server/AsgardeoProvider';
19
19
  export * from './server/AsgardeoProvider';
20
+ export { default as useAsgardeo } from './client/contexts/Asgardeo/useAsgardeo';
21
+ export * from './client/contexts/Asgardeo/useAsgardeo';
20
22
  export { default as isSignedIn } from './server/actions/isSignedIn';
23
+ export { default as handleOAuthCallback } from './server/actions/handleOAuthCallbackAction';
21
24
  export { default as SignedIn } from './client/components/control/SignedIn/SignedIn';
22
25
  export { default as SignedOut } from './client/components/control/SignedOut/SignedOut';
23
26
  export { default as SignInButton } from './client/components/actions/SignInButton/SignInButton';
27
+ export { default as SignUpButton } from './client/components/actions/SignUpButton/SignUpButton';
28
+ export { default as SignIn } from './client/components/presentation/SignIn/SignIn';
24
29
  export { default as SignOutButton } from './client/components/actions/SignOutButton/SignOutButton';
25
30
  export { default as User } from './client/components/presentation/User/User';
31
+ export { default as SignUp } from './client/components/presentation/SignUp/SignUp';
32
+ export { default as UserDropdown } from './client/components/presentation/UserDropdown/UserDropdown';
33
+ export { default as UserProfile } from './client/components/presentation/UserProfile/UserProfile';
26
34
  export { default as AsgardeoNext } from './AsgardeoNextClient';
35
+ export { default as asgardeoMiddleware } from './middleware/asgardeoMiddleware';
27
36
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +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,+CAA+C,CAAC;AAGlF,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,iDAAiD,CAAC;AAGrF,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,uDAAuD,CAAC;AAG9F,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,yDAAyD,CAAC;AAGjG,OAAO,EAAC,OAAO,IAAI,IAAI,EAAC,MAAM,4CAA4C,CAAC;AAG3E,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,sBAAs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, 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 { NextRequest, NextResponse } from 'next/server';
19
+ import { AsgardeoNextConfig } from '../models/config';
20
+ export interface AsgardeoMiddlewareOptions extends Partial<AsgardeoNextConfig> {
21
+ debug?: boolean;
22
+ }
23
+ type AsgardeoAuth = {
24
+ protect: (options?: {
25
+ redirect?: string;
26
+ }) => Promise<NextResponse | void>;
27
+ isSignedIn: () => Promise<boolean>;
28
+ getUser: () => Promise<any | null>;
29
+ redirectToSignIn: (afterSignInUrl?: string) => NextResponse;
30
+ };
31
+ type AsgardeoMiddlewareHandler = (auth: AsgardeoAuth, req: NextRequest) => Promise<NextResponse | void> | NextResponse | void;
32
+ /**
33
+ * Asgardeo middleware that integrates authentication into your Next.js application.
34
+ * Similar to Clerk's clerkMiddleware pattern.
35
+ *
36
+ * @param handler - Optional handler function to customize middleware behavior
37
+ * @param options - Configuration options for the middleware
38
+ * @returns Next.js middleware function
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * // middleware.ts
43
+ * import { asgardeoMiddleware } from '@asgardeo/nextjs';
44
+ *
45
+ * export default asgardeoMiddleware();
46
+ * ```
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * // With protection
51
+ * import { asgardeoMiddleware, createRouteMatcher } from '@asgardeo/nextjs';
52
+ *
53
+ * const isProtectedRoute = createRouteMatcher(['/dashboard(.*)']);
54
+ *
55
+ * export default asgardeoMiddleware(async (auth, req) => {
56
+ * if (isProtectedRoute(req)) {
57
+ * await auth.protect();
58
+ * }
59
+ * });
60
+ * ```
61
+ */
62
+ declare const asgardeoMiddleware: (handler?: AsgardeoMiddlewareHandler, options?: AsgardeoMiddlewareOptions | ((req: NextRequest) => AsgardeoMiddlewareOptions)) => ((request: NextRequest) => Promise<NextResponse>);
63
+ export default asgardeoMiddleware;
@@ -0,0 +1,115 @@
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 { NextResponse } from 'next/server';
19
+ import AsgardeoNextClient from '../AsgardeoNextClient';
20
+ /**
21
+ * Asgardeo middleware that integrates authentication into your Next.js application.
22
+ * Similar to Clerk's clerkMiddleware pattern.
23
+ *
24
+ * @param handler - Optional handler function to customize middleware behavior
25
+ * @param options - Configuration options for the middleware
26
+ * @returns Next.js middleware function
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * // middleware.ts
31
+ * import { asgardeoMiddleware } from '@asgardeo/nextjs';
32
+ *
33
+ * export default asgardeoMiddleware();
34
+ * ```
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * // With protection
39
+ * import { asgardeoMiddleware, createRouteMatcher } from '@asgardeo/nextjs';
40
+ *
41
+ * const isProtectedRoute = createRouteMatcher(['/dashboard(.*)']);
42
+ *
43
+ * export default asgardeoMiddleware(async (auth, req) => {
44
+ * if (isProtectedRoute(req)) {
45
+ * await auth.protect();
46
+ * }
47
+ * });
48
+ * ```
49
+ */
50
+ const asgardeoMiddleware = (handler, options) => {
51
+ return async (request) => {
52
+ // Resolve options - can be static or dynamic based on request
53
+ const resolvedOptions = typeof options === 'function' ? options(request) : options || {};
54
+ const asgardeoClient = AsgardeoNextClient.getInstance();
55
+ // // Initialize client if not already done
56
+ // if (!asgardeoClient.isInitialized && resolvedOptions) {
57
+ // asgardeoClient.initialize(resolvedOptions);
58
+ // }
59
+ // // Debug logging
60
+ // if (resolvedOptions.debug) {
61
+ // console.log(`[Asgardeo Middleware] Processing request: ${request.nextUrl.pathname}`);
62
+ // }
63
+ // // Handle auth API routes automatically
64
+ // if (request.nextUrl.pathname.startsWith('/api/auth/asgardeo')) {
65
+ // if (resolvedOptions.debug) {
66
+ // console.log(`[Asgardeo Middleware] Handling auth route: ${request.nextUrl.pathname}`);
67
+ // }
68
+ // return await asgardeoClient.handleAuthRequest(request);
69
+ // }
70
+ // // Create auth object for the handler
71
+ // const auth: AsgardeoAuth = {
72
+ // protect: async (options?: {redirect?: string}) => {
73
+ // const isSignedIn = await asgardeoClient.isSignedIn(request);
74
+ // if (!isSignedIn) {
75
+ // const afterSignInUrl = options?.redirect || '/api/auth/asgardeo/signin';
76
+ // return NextResponse.redirect(new URL(afterSignInUrl, request.url));
77
+ // }
78
+ // },
79
+ // isSignedIn: async () => {
80
+ // return await asgardeoClient.isSignedIn(request);
81
+ // },
82
+ // getUser: async () => {
83
+ // return await asgardeoClient.getUser(request);
84
+ // },
85
+ // redirectToSignIn: (afterSignInUrl?: string) => {
86
+ // const signInUrl = afterSignInUrl || '/api/auth/asgardeo/signin';
87
+ // return NextResponse.redirect(new URL(signInUrl, request.url));
88
+ // },
89
+ // };
90
+ // // Execute user-provided handler if present
91
+ // let handlerResponse: NextResponse | void;
92
+ // if (handler) {
93
+ // handlerResponse = await handler(auth, request);
94
+ // }
95
+ // // If handler returned a response, use it
96
+ // if (handlerResponse) {
97
+ // return handlerResponse;
98
+ // }
99
+ // // Otherwise, continue with default behavior
100
+ // const response = NextResponse.next();
101
+ // // Add authentication context to response headers
102
+ // const isSignedIn = await asgardeoClient.isSignedIn(request);
103
+ // if (isSignedIn) {
104
+ // response.headers.set('x-asgardeo-authenticated', 'true');
105
+ // const user = await asgardeoClient.getUser(request);
106
+ // if (user?.sub) {
107
+ // response.headers.set('x-asgardeo-user-id', user.sub);
108
+ // }
109
+ // }
110
+ // return response;
111
+ return NextResponse.next();
112
+ };
113
+ };
114
+ export default asgardeoMiddleware;
115
+ //# sourceMappingURL=asgardeoMiddleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asgardeoMiddleware.js","sourceRoot":"","sources":["../../src/middleware/asgardeoMiddleware.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAc,YAAY,EAAC,MAAM,aAAa,CAAC;AACtD,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AAmBvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,kBAAkB,GAAG,CACzB,OAAmC,EACnC,OAAuF,EACpC,EAAE;IACrD,OAAO,KAAK,EAAE,OAAoB,EAAyB,EAAE;QAC3D,8DAA8D;QAC9D,MAAM,eAAe,GAAG,OAAO,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC;QAEzF,MAAM,cAAc,GAAG,kBAAkB,CAAC,WAAW,EAAE,CAAC;QAExD,2CAA2C;QAC3C,0DAA0D;QAC1D,gDAAgD;QAChD,IAAI;QAEJ,mBAAmB;QACnB,+BAA+B;QAC/B,0FAA0F;QAC1F,IAAI;QAEJ,0CAA0C;QAC1C,mEAAmE;QACnE,iCAAiC;QACjC,6FAA6F;QAC7F,MAAM;QACN,4DAA4D;QAC5D,IAAI;QAEJ,wCAAwC;QACxC,+BAA+B;QAC/B,wDAAwD;QACxD,mEAAmE;QACnE,yBAAyB;QACzB,iFAAiF;QACjF,4EAA4E;QAC5E,QAAQ;QACR,OAAO;QAEP,8BAA8B;QAC9B,uDAAuD;QACvD,OAAO;QAEP,2BAA2B;QAC3B,oDAAoD;QACpD,OAAO;QAEP,qDAAqD;QACrD,uEAAuE;QACvE,qEAAqE;QACrE,OAAO;QACP,KAAK;QAEL,8CAA8C;QAC9C,4CAA4C;QAC5C,iBAAiB;QACjB,oDAAoD;QACpD,IAAI;QAEJ,4CAA4C;QAC5C,yBAAyB;QACzB,4BAA4B;QAC5B,IAAI;QAEJ,+CAA+C;QAC/C,wCAAwC;QAExC,oDAAoD;QACpD,+DAA+D;QAC/D,oBAAoB;QACpB,8DAA8D;QAC9D,wDAAwD;QACxD,qBAAqB;QACrB,4DAA4D;QAC5D,MAAM;QACN,IAAI;QAEJ,mBAAmB;QAEnB,OAAO,YAAY,CAAC,IAAI,EAAE,CAAC;IAC7B,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -16,20 +16,23 @@
16
16
  * under the License.
17
17
  */
18
18
  import { FC, PropsWithChildren } from 'react';
19
- import { AsgardeoClientProviderProps } from '../client/contexts/Asgardeo/AsgardeoProvider';
19
+ import { AsgardeoProviderProps } from '@asgardeo/react';
20
20
  /**
21
21
  * Props interface of {@link AsgardeoServerProvider}
22
22
  */
23
- export type AsgardeoServerProviderProps = AsgardeoClientProviderProps;
23
+ export type AsgardeoServerProviderProps = Partial<AsgardeoProviderProps> & {
24
+ clientSecret?: string;
25
+ };
24
26
  /**
25
27
  * Server-side provider component for Asgardeo authentication.
26
28
  * Wraps the client-side provider and handles server-side authentication logic.
29
+ * Uses the singleton AsgardeoNextClient instance for consistent authentication state.
27
30
  *
28
31
  * @param props - Props injected into the component.
29
32
  *
30
33
  * @example
31
34
  * ```tsx
32
- * <AsgardeoServerProvider>
35
+ * <AsgardeoServerProvider config={asgardeoConfig}>
33
36
  * <YourApp />
34
37
  * </AsgardeoServerProvider>
35
38
  * ```
@@ -1,20 +1,59 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { AsgardeoRuntimeError } from '@asgardeo/node';
2
3
  import AsgardeoClientProvider from '../client/contexts/Asgardeo/AsgardeoProvider';
4
+ import AsgardeoNextClient from '../AsgardeoNextClient';
5
+ import signInAction from './actions/signInAction';
6
+ import signOutAction from './actions/signOutAction';
7
+ import isSignedIn from './actions/isSignedIn';
8
+ import getUserAction from './actions/getUserAction';
9
+ import getSessionId from './actions/getSessionId';
10
+ import getUserProfileAction from './actions/getUserProfileAction';
11
+ import signUpAction from './actions/signUpAction';
12
+ import handleOAuthCallbackAction from './actions/handleOAuthCallbackAction';
3
13
  /**
4
14
  * Server-side provider component for Asgardeo authentication.
5
15
  * Wraps the client-side provider and handles server-side authentication logic.
16
+ * Uses the singleton AsgardeoNextClient instance for consistent authentication state.
6
17
  *
7
18
  * @param props - Props injected into the component.
8
19
  *
9
20
  * @example
10
21
  * ```tsx
11
- * <AsgardeoServerProvider>
22
+ * <AsgardeoServerProvider config={asgardeoConfig}>
12
23
  * <YourApp />
13
24
  * </AsgardeoServerProvider>
14
25
  * ```
15
26
  *
16
27
  * @returns AsgardeoServerProvider component.
17
28
  */
18
- const AsgardeoServerProvider = ({ children, }) => (_jsx(AsgardeoClientProvider, { children: children }));
29
+ const AsgardeoServerProvider = async ({ children, afterSignInUrl, afterSignOutUrl, ..._config }) => {
30
+ const asgardeoClient = AsgardeoNextClient.getInstance();
31
+ let config = {};
32
+ try {
33
+ await asgardeoClient.initialize(_config);
34
+ config = await asgardeoClient.getConfiguration();
35
+ }
36
+ catch (error) {
37
+ throw new AsgardeoRuntimeError(`Failed to initialize Asgardeo client: ${error?.toString()}`, 'next-ConfigurationError-001', 'next', 'An error occurred while initializing the Asgardeo client. Please check your configuration.');
38
+ }
39
+ if (!asgardeoClient.isInitialized) {
40
+ return _jsx(_Fragment, {});
41
+ }
42
+ const sessionId = (await getSessionId());
43
+ const _isSignedIn = await isSignedIn(sessionId);
44
+ let user = {};
45
+ let userProfile = {
46
+ schemas: [],
47
+ profile: {},
48
+ flattenedProfile: {},
49
+ };
50
+ if (_isSignedIn) {
51
+ const userResponse = await getUserAction(sessionId);
52
+ const userProfileResponse = await getUserProfileAction(sessionId);
53
+ user = userResponse.data?.user || {};
54
+ userProfile = userProfileResponse.data?.userProfile;
55
+ }
56
+ return (_jsx(AsgardeoClientProvider, { baseUrl: config.baseUrl, signIn: signInAction, signOut: signOutAction, signUp: signUpAction, handleOAuthCallback: handleOAuthCallbackAction, signInUrl: config.signInUrl, signUpUrl: config.signUpUrl, preferences: config.preferences, clientId: config.clientId, user: user, userProfile: userProfile, isSignedIn: _isSignedIn, children: children }));
57
+ };
19
58
  export default AsgardeoServerProvider;
20
59
  //# sourceMappingURL=AsgardeoProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AsgardeoProvider.js","sourceRoot":"","sources":["../../src/server/AsgardeoProvider.tsx"],"names":[],"mappings":";AAmBA,OAAO,sBAAqD,MAAM,8CAA8C,CAAC;AAOjH;;;;;;;;;;;;;;GAcG;AACH,MAAM,sBAAsB,GAAuD,CAAC,EAClF,QAAQ,GACuC,EAAgB,EAAE,CAAC,CAClE,KAAC,sBAAsB,cAAE,QAAQ,GAA0B,CAC5D,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"AsgardeoProvider.js","sourceRoot":"","sources":["../../src/server/AsgardeoProvider.tsx"],"names":[],"mappings":";AAmBA,OAAO,EAAC,oBAAoB,EAAoB,MAAM,gBAAgB,CAAC;AACvE,OAAO,sBAAqD,MAAM,8CAA8C,CAAC;AACjH,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AACvD,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,aAAa,MAAM,yBAAyB,CAAC;AAEpD,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,aAAa,MAAM,yBAAyB,CAAC;AACpD,OAAO,YAAY,MAAM,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AAI,IAAI,EAAE,CAAC;QACrC,WAAW,GAAG,mBAAmB,CAAC,IAAI,EAAE,WAAW,CAAC;IACtD,CAAC;IAED,OAAO,CACL,KAAC,sBAAsB,IACrB,OAAO,EAAE,MAAM,CAAC,OAAO,EACvB,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,YAAY,EACpB,mBAAmB,EAAE,yBAAyB,EAC9C,SAAS,EAAE,MAAM,CAAC,SAAS,EAC3B,SAAS,EAAE,MAAM,CAAC,SAAS,EAC3B,WAAW,EAAE,MAAM,CAAC,WAAW,EAC/B,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,WAAW,YAEtB,QAAQ,GACc,CAC1B,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
@@ -0,0 +1,2 @@
1
+ declare const getClientOrigin: () => Promise<string>;
2
+ export default getClientOrigin;
@@ -0,0 +1,10 @@
1
+ 'use server';
2
+ import { headers } from 'next/headers';
3
+ const getClientOrigin = async () => {
4
+ const headersList = await headers();
5
+ const host = headersList.get('host');
6
+ const protocol = headersList.get('x-forwarded-proto') ?? 'http';
7
+ return `${protocol}://${host}`;
8
+ };
9
+ export default getClientOrigin;
10
+ //# sourceMappingURL=getClientOrigin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getClientOrigin.js","sourceRoot":"","sources":["../../../src/server/actions/getClientOrigin.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAErC,MAAM,eAAe,GAAG,KAAK,IAAI,EAAE;IACjC,MAAM,WAAW,GAAG,MAAM,OAAO,EAAE,CAAC;IACpC,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,MAAM,CAAC;IAChE,OAAO,GAAG,QAAQ,MAAM,IAAI,EAAE,CAAC;AACjC,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -0,0 +1,35 @@
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
+ * Server action to get the current user.
20
+ * Returns the user profile if signed in.
21
+ */
22
+ declare const getUserAction: (sessionId: string) => Promise<{
23
+ success: boolean;
24
+ data: {
25
+ user: import("@asgardeo/node").User;
26
+ };
27
+ error: null;
28
+ } | {
29
+ success: boolean;
30
+ data: {
31
+ user: null;
32
+ };
33
+ error: string;
34
+ }>;
35
+ export default getUserAction;
@@ -0,0 +1,35 @@
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 AsgardeoNextClient from '../../AsgardeoNextClient';
20
+ /**
21
+ * Server action to get the current user.
22
+ * Returns the user profile if signed in.
23
+ */
24
+ const getUserAction = async (sessionId) => {
25
+ try {
26
+ const client = AsgardeoNextClient.getInstance();
27
+ const user = await client.getUser(sessionId);
28
+ return { success: true, data: { user }, error: null };
29
+ }
30
+ catch (error) {
31
+ return { success: false, data: { user: null }, error: 'Failed to get user' };
32
+ }
33
+ };
34
+ export default getUserAction;
35
+ //# sourceMappingURL=getUserAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getUserAction.js","sourceRoot":"","sources":["../../../src/server/actions/getUserAction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;AAEb,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAE1D;;;GAGG;AACH,MAAM,aAAa,GAAG,KAAK,EAAE,SAAiB,EAAE,EAAE;IAChD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,EAAE,CAAC;QAChD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC7C,OAAO,EAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,EAAE,IAAI,EAAC,CAAC;IACpD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAC,IAAI,EAAE,IAAI,EAAC,EAAE,KAAK,EAAE,oBAAoB,EAAC,CAAC;IAC3E,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -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 { UserProfile } from '@asgardeo/node';
19
+ /**
20
+ * Server action to get the current user.
21
+ * Returns the user profile if signed in.
22
+ */
23
+ declare const getUserProfileAction: (sessionId: string) => Promise<{
24
+ success: boolean;
25
+ data: {
26
+ userProfile: UserProfile;
27
+ };
28
+ error: null;
29
+ } | {
30
+ success: boolean;
31
+ data: {
32
+ userProfile: {
33
+ schemas: never[];
34
+ profile: {};
35
+ flattenedProfile: {};
36
+ };
37
+ };
38
+ error: string;
39
+ }>;
40
+ export default getUserProfileAction;
@@ -0,0 +1,45 @@
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 AsgardeoNextClient from '../../AsgardeoNextClient';
20
+ /**
21
+ * Server action to get the current user.
22
+ * Returns the user profile if signed in.
23
+ */
24
+ const getUserProfileAction = async (sessionId) => {
25
+ try {
26
+ const client = AsgardeoNextClient.getInstance();
27
+ const updatedProfile = await client.getUserProfile(sessionId);
28
+ return { success: true, data: { userProfile: updatedProfile }, error: null };
29
+ }
30
+ catch (error) {
31
+ return {
32
+ success: false,
33
+ data: {
34
+ userProfile: {
35
+ schemas: [],
36
+ profile: {},
37
+ flattenedProfile: {},
38
+ },
39
+ },
40
+ error: 'Failed to get user profile',
41
+ };
42
+ }
43
+ };
44
+ export default getUserProfileAction;
45
+ //# sourceMappingURL=getUserProfileAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getUserProfileAction.js","sourceRoot":"","sources":["../../../src/server/actions/getUserProfileAction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,CAAC;AAGb,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAE1D;;;GAGG;AACH,MAAM,oBAAoB,GAAG,KAAK,EAAE,SAAiB,EAAE,EAAE;IACvD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,EAAE,CAAC;QAChD,MAAM,cAAc,GAAgB,MAAM,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QAC3E,OAAO,EAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAC,WAAW,EAAE,cAAc,EAAC,EAAE,KAAK,EAAE,IAAI,EAAC,CAAC;IAC3E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,IAAI,EAAE;gBACJ,WAAW,EAAE;oBACX,OAAO,EAAE,EAAE;oBACX,OAAO,EAAE,EAAE;oBACX,gBAAgB,EAAE,EAAE;iBACrB;aACF;YACD,KAAK,EAAE,4BAA4B;SACpC,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,33 @@
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
+ * Server action to handle OAuth callback with authorization code.
20
+ * This action processes the authorization code received from the OAuth provider
21
+ * and exchanges it for tokens to complete the authentication flow.
22
+ *
23
+ * @param code - Authorization code from OAuth provider
24
+ * @param state - State parameter from OAuth provider for CSRF protection
25
+ * @param sessionState - Session state parameter from OAuth provider
26
+ * @returns Promise that resolves with success status and optional error message
27
+ */
28
+ declare const handleOAuthCallbackAction: (code: string, state: string, sessionState?: string) => Promise<{
29
+ success: boolean;
30
+ error?: string;
31
+ redirectUrl?: string;
32
+ }>;
33
+ export default handleOAuthCallbackAction;