@thunderid/nextjs 0.10.3 → 0.10.4

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 (179) hide show
  1. package/dist/ThunderIDNextClient.d.ts +0 -17
  2. package/dist/ThunderIDNextClient.d.ts.map +1 -1
  3. package/dist/ThunderIDNextClient.js.map +1 -1
  4. package/dist/cjs/ThunderIDNextClient.cjs.map +1 -1
  5. package/dist/cjs/client/components/actions/SignInButton/SignInButton.cjs.map +1 -1
  6. package/dist/cjs/client/components/actions/SignOutButton/SignOutButton.cjs.map +1 -1
  7. package/dist/cjs/client/components/actions/SignUpButton/SignUpButton.cjs.map +1 -1
  8. package/dist/cjs/client/components/control/SignedIn/SignedIn.cjs.map +1 -1
  9. package/dist/cjs/client/components/control/SignedOut/SignedOut.cjs.map +1 -1
  10. package/dist/cjs/client/components/presentation/SignIn/SignIn.cjs.map +1 -1
  11. package/dist/cjs/client/components/presentation/SignUp/SignUp.cjs.map +1 -1
  12. package/dist/cjs/client/components/presentation/User/User.cjs.map +1 -1
  13. package/dist/cjs/client/components/presentation/UserAvatar/UserAvatar.cjs.map +1 -1
  14. package/dist/cjs/client/components/presentation/UserDropdown/UserDropdown.cjs.map +1 -1
  15. package/dist/cjs/client/components/presentation/UserProfile/UserProfile.cjs.map +1 -1
  16. package/dist/cjs/client/contexts/ThunderID/ThunderIDContext.cjs.map +1 -1
  17. package/dist/cjs/client/contexts/ThunderID/ThunderIDProvider.cjs.map +1 -1
  18. package/dist/cjs/client/contexts/ThunderID/useThunderID.cjs.map +1 -1
  19. package/dist/cjs/constants/sessionConstants.cjs +0 -17
  20. package/dist/cjs/constants/sessionConstants.cjs.map +1 -1
  21. package/dist/cjs/server/ThunderIDProvider.cjs.map +1 -1
  22. package/dist/cjs/server/actions/clearSession.cjs.map +1 -1
  23. package/dist/cjs/server/actions/getAccessToken.cjs.map +1 -1
  24. package/dist/cjs/server/actions/getClientOrigin.cjs.map +1 -1
  25. package/dist/cjs/server/actions/getSessionId.cjs.map +1 -1
  26. package/dist/cjs/server/actions/getSessionPayload.cjs.map +1 -1
  27. package/dist/cjs/server/actions/getUserAction.cjs.map +1 -1
  28. package/dist/cjs/server/actions/getUserProfileAction.cjs.map +1 -1
  29. package/dist/cjs/server/actions/handleOAuthCallbackAction.cjs.map +1 -1
  30. package/dist/cjs/server/actions/isSignedIn.cjs.map +1 -1
  31. package/dist/cjs/server/actions/refreshToken.cjs.map +1 -1
  32. package/dist/cjs/server/actions/signInAction.cjs.map +1 -1
  33. package/dist/cjs/server/actions/signOutAction.cjs.map +1 -1
  34. package/dist/cjs/server/actions/signUpAction.cjs.map +1 -1
  35. package/dist/cjs/server/actions/updateUserProfileAction.cjs.map +1 -1
  36. package/dist/cjs/server/getClient.cjs.map +1 -1
  37. package/dist/cjs/server/proxy/createRouteMatcher.cjs.map +1 -1
  38. package/dist/cjs/server/proxy/thunderIDProxy.cjs.map +1 -1
  39. package/dist/cjs/server/thunderid.cjs.map +1 -1
  40. package/dist/cjs/utils/SessionManager.cjs.map +1 -1
  41. package/dist/cjs/utils/decorateConfigWithNextEnv.cjs.map +1 -1
  42. package/dist/cjs/utils/handleRefreshToken.cjs.map +1 -1
  43. package/dist/cjs/utils/logger.cjs.map +1 -1
  44. package/dist/cjs/utils/sessionUtils.cjs.map +1 -1
  45. package/dist/client/components/actions/SignInButton/SignInButton.d.ts +0 -17
  46. package/dist/client/components/actions/SignInButton/SignInButton.d.ts.map +1 -1
  47. package/dist/client/components/actions/SignInButton/SignInButton.js.map +1 -1
  48. package/dist/client/components/actions/SignOutButton/SignOutButton.d.ts +0 -17
  49. package/dist/client/components/actions/SignOutButton/SignOutButton.d.ts.map +1 -1
  50. package/dist/client/components/actions/SignOutButton/SignOutButton.js.map +1 -1
  51. package/dist/client/components/actions/SignUpButton/SignUpButton.d.ts +0 -17
  52. package/dist/client/components/actions/SignUpButton/SignUpButton.d.ts.map +1 -1
  53. package/dist/client/components/actions/SignUpButton/SignUpButton.js.map +1 -1
  54. package/dist/client/components/control/Loading/Loading.d.ts +0 -17
  55. package/dist/client/components/control/Loading/Loading.d.ts.map +1 -1
  56. package/dist/client/components/control/SignedIn/SignedIn.d.ts +0 -17
  57. package/dist/client/components/control/SignedIn/SignedIn.d.ts.map +1 -1
  58. package/dist/client/components/control/SignedIn/SignedIn.js.map +1 -1
  59. package/dist/client/components/control/SignedOut/SignedOut.d.ts +0 -17
  60. package/dist/client/components/control/SignedOut/SignedOut.d.ts.map +1 -1
  61. package/dist/client/components/control/SignedOut/SignedOut.js.map +1 -1
  62. package/dist/client/components/presentation/SignIn/SignIn.d.ts +0 -17
  63. package/dist/client/components/presentation/SignIn/SignIn.d.ts.map +1 -1
  64. package/dist/client/components/presentation/SignIn/SignIn.js.map +1 -1
  65. package/dist/client/components/presentation/SignUp/SignUp.d.ts +0 -17
  66. package/dist/client/components/presentation/SignUp/SignUp.d.ts.map +1 -1
  67. package/dist/client/components/presentation/SignUp/SignUp.js.map +1 -1
  68. package/dist/client/components/presentation/User/User.d.ts +0 -17
  69. package/dist/client/components/presentation/User/User.d.ts.map +1 -1
  70. package/dist/client/components/presentation/User/User.js.map +1 -1
  71. package/dist/client/components/presentation/UserAvatar/UserAvatar.d.ts +0 -17
  72. package/dist/client/components/presentation/UserAvatar/UserAvatar.d.ts.map +1 -1
  73. package/dist/client/components/presentation/UserAvatar/UserAvatar.js.map +1 -1
  74. package/dist/client/components/presentation/UserDropdown/UserDropdown.d.ts +0 -17
  75. package/dist/client/components/presentation/UserDropdown/UserDropdown.d.ts.map +1 -1
  76. package/dist/client/components/presentation/UserDropdown/UserDropdown.js.map +1 -1
  77. package/dist/client/components/presentation/UserProfile/UserProfile.d.ts +0 -17
  78. package/dist/client/components/presentation/UserProfile/UserProfile.d.ts.map +1 -1
  79. package/dist/client/components/presentation/UserProfile/UserProfile.js.map +1 -1
  80. package/dist/client/contexts/ThunderID/ThunderIDContext.d.ts +0 -17
  81. package/dist/client/contexts/ThunderID/ThunderIDContext.d.ts.map +1 -1
  82. package/dist/client/contexts/ThunderID/ThunderIDContext.js.map +1 -1
  83. package/dist/client/contexts/ThunderID/ThunderIDProvider.d.ts +0 -17
  84. package/dist/client/contexts/ThunderID/ThunderIDProvider.d.ts.map +1 -1
  85. package/dist/client/contexts/ThunderID/ThunderIDProvider.js.map +1 -1
  86. package/dist/client/contexts/ThunderID/useThunderID.d.ts +0 -17
  87. package/dist/client/contexts/ThunderID/useThunderID.d.ts.map +1 -1
  88. package/dist/client/contexts/ThunderID/useThunderID.js.map +1 -1
  89. package/dist/client/index.d.ts +0 -17
  90. package/dist/client/index.d.ts.map +1 -1
  91. package/dist/configs/InternalAuthAPIRoutesConfig.d.ts +0 -17
  92. package/dist/configs/InternalAuthAPIRoutesConfig.d.ts.map +1 -1
  93. package/dist/constants/sessionConstants.d.ts +0 -17
  94. package/dist/constants/sessionConstants.d.ts.map +1 -1
  95. package/dist/constants/sessionConstants.js +0 -17
  96. package/dist/constants/sessionConstants.js.map +1 -1
  97. package/dist/index.d.ts +0 -17
  98. package/dist/index.d.ts.map +1 -1
  99. package/dist/models/api.d.ts +0 -17
  100. package/dist/models/api.d.ts.map +1 -1
  101. package/dist/models/config.d.ts +0 -17
  102. package/dist/models/config.d.ts.map +1 -1
  103. package/dist/server/ThunderIDProvider.d.ts +0 -17
  104. package/dist/server/ThunderIDProvider.d.ts.map +1 -1
  105. package/dist/server/ThunderIDProvider.js.map +1 -1
  106. package/dist/server/actions/clearSession.d.ts +0 -17
  107. package/dist/server/actions/clearSession.d.ts.map +1 -1
  108. package/dist/server/actions/clearSession.js.map +1 -1
  109. package/dist/server/actions/getAccessToken.d.ts +0 -17
  110. package/dist/server/actions/getAccessToken.d.ts.map +1 -1
  111. package/dist/server/actions/getAccessToken.js.map +1 -1
  112. package/dist/server/actions/getClientOrigin.d.ts +0 -17
  113. package/dist/server/actions/getClientOrigin.d.ts.map +1 -1
  114. package/dist/server/actions/getClientOrigin.js.map +1 -1
  115. package/dist/server/actions/getSessionId.d.ts +0 -17
  116. package/dist/server/actions/getSessionId.d.ts.map +1 -1
  117. package/dist/server/actions/getSessionId.js.map +1 -1
  118. package/dist/server/actions/getSessionPayload.d.ts +0 -17
  119. package/dist/server/actions/getSessionPayload.d.ts.map +1 -1
  120. package/dist/server/actions/getSessionPayload.js.map +1 -1
  121. package/dist/server/actions/getUserAction.d.ts +0 -17
  122. package/dist/server/actions/getUserAction.d.ts.map +1 -1
  123. package/dist/server/actions/getUserAction.js.map +1 -1
  124. package/dist/server/actions/getUserProfileAction.d.ts +0 -17
  125. package/dist/server/actions/getUserProfileAction.d.ts.map +1 -1
  126. package/dist/server/actions/getUserProfileAction.js.map +1 -1
  127. package/dist/server/actions/handleOAuthCallbackAction.d.ts +0 -17
  128. package/dist/server/actions/handleOAuthCallbackAction.d.ts.map +1 -1
  129. package/dist/server/actions/handleOAuthCallbackAction.js.map +1 -1
  130. package/dist/server/actions/isSignedIn.d.ts +0 -17
  131. package/dist/server/actions/isSignedIn.d.ts.map +1 -1
  132. package/dist/server/actions/isSignedIn.js.map +1 -1
  133. package/dist/server/actions/refreshToken.d.ts +0 -17
  134. package/dist/server/actions/refreshToken.d.ts.map +1 -1
  135. package/dist/server/actions/refreshToken.js.map +1 -1
  136. package/dist/server/actions/signInAction.d.ts +0 -17
  137. package/dist/server/actions/signInAction.d.ts.map +1 -1
  138. package/dist/server/actions/signInAction.js.map +1 -1
  139. package/dist/server/actions/signOutAction.d.ts +0 -17
  140. package/dist/server/actions/signOutAction.d.ts.map +1 -1
  141. package/dist/server/actions/signOutAction.js.map +1 -1
  142. package/dist/server/actions/signUpAction.d.ts +0 -17
  143. package/dist/server/actions/signUpAction.d.ts.map +1 -1
  144. package/dist/server/actions/signUpAction.js.map +1 -1
  145. package/dist/server/actions/updateUserProfileAction.d.ts +0 -17
  146. package/dist/server/actions/updateUserProfileAction.d.ts.map +1 -1
  147. package/dist/server/actions/updateUserProfileAction.js.map +1 -1
  148. package/dist/server/getClient.d.ts +0 -17
  149. package/dist/server/getClient.d.ts.map +1 -1
  150. package/dist/server/getClient.js.map +1 -1
  151. package/dist/server/index.d.ts +0 -17
  152. package/dist/server/index.d.ts.map +1 -1
  153. package/dist/server/proxy/createRouteMatcher.d.ts +0 -17
  154. package/dist/server/proxy/createRouteMatcher.d.ts.map +1 -1
  155. package/dist/server/proxy/createRouteMatcher.js.map +1 -1
  156. package/dist/server/proxy/thunderIDProxy.d.ts +0 -17
  157. package/dist/server/proxy/thunderIDProxy.d.ts.map +1 -1
  158. package/dist/server/proxy/thunderIDProxy.js.map +1 -1
  159. package/dist/server/thunderid.d.ts +0 -17
  160. package/dist/server/thunderid.d.ts.map +1 -1
  161. package/dist/server/thunderid.js.map +1 -1
  162. package/dist/utils/SessionManager.d.ts +0 -17
  163. package/dist/utils/SessionManager.d.ts.map +1 -1
  164. package/dist/utils/SessionManager.js.map +1 -1
  165. package/dist/utils/createRouteMatcher.d.ts +0 -17
  166. package/dist/utils/createRouteMatcher.d.ts.map +1 -1
  167. package/dist/utils/decorateConfigWithNextEnv.d.ts +0 -17
  168. package/dist/utils/decorateConfigWithNextEnv.d.ts.map +1 -1
  169. package/dist/utils/decorateConfigWithNextEnv.js.map +1 -1
  170. package/dist/utils/handleRefreshToken.d.ts +0 -17
  171. package/dist/utils/handleRefreshToken.d.ts.map +1 -1
  172. package/dist/utils/handleRefreshToken.js.map +1 -1
  173. package/dist/utils/logger.d.ts +0 -17
  174. package/dist/utils/logger.d.ts.map +1 -1
  175. package/dist/utils/logger.js.map +1 -1
  176. package/dist/utils/sessionUtils.d.ts +0 -17
  177. package/dist/utils/sessionUtils.d.ts.map +1 -1
  178. package/dist/utils/sessionUtils.js.map +1 -1
  179. package/package.json +4 -4
@@ -1,20 +1,3 @@
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
1
  /**
19
2
  * Deletes all ThunderID session cookies from the browser without contacting the
20
3
  * identity server.
@@ -1 +1 @@
1
- {"version":3,"file":"clearSession.d.ts","sourceRoot":"","sources":["../../../src/server/actions/clearSession.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAUH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,YAAY,QAAa,OAAO,CAAC,IAAI,CAK1C,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"clearSession.d.ts","sourceRoot":"","sources":["../../../src/server/actions/clearSession.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,YAAY,QAAa,OAAO,CAAC,IAAI,CAK1C,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"clearSession.js","names":["cookieStore: RequestCookies","SessionManager"],"sources":["../../../src/server/actions/clearSession.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n'use server';\n\nimport {cookies} from 'next/headers';\nimport logger from '../../utils/logger';\nimport SessionManager from '../../utils/SessionManager';\n\ntype RequestCookies = Awaited<ReturnType<typeof cookies>>;\n\n/**\n * Deletes all ThunderID session cookies from the browser without contacting the\n * identity server.\n *\n * Use this for error-recovery scenarios where the local session must be wiped\n * immediately: refresh token failures, corrupt sessions, or forced local sign-out\n * when the identity server is unreachable.\n *\n * For a complete sign-out that also revokes the server-side session and obtains the\n * after-sign-out redirect URL, use `signOutAction` instead.\n *\n * @example\n * ```typescript\n * import { clearSession } from '@thunderid/nextjs/server';\n *\n * // Inside a Server Action or Route Handler:\n * await clearSession();\n * redirect('/sign-in');\n * ```\n */\nconst clearSession = async (): Promise<void> => {\n const cookieStore: RequestCookies = await cookies();\n cookieStore.delete(SessionManager.getSessionCookieName());\n cookieStore.delete(SessionManager.getTempSessionCookieName());\n logger.debug('[clearSession] Session cookies cleared.');\n};\n\nexport default clearSession;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,MAAM,eAAe,YAA2B;CAC9C,MAAMA,cAA8B,MAAM,SAAS;AACnD,aAAY,OAAOC,uBAAe,sBAAsB,CAAC;AACzD,aAAY,OAAOA,uBAAe,0BAA0B,CAAC;AAC7D,gBAAO,MAAM,0CAA0C;;AAGzD,2BAAe"}
1
+ {"version":3,"file":"clearSession.js","names":["cookieStore: RequestCookies","SessionManager"],"sources":["../../../src/server/actions/clearSession.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n'use server';\n\nimport {cookies} from 'next/headers';\nimport logger from '../../utils/logger';\nimport SessionManager from '../../utils/SessionManager';\n\ntype RequestCookies = Awaited<ReturnType<typeof cookies>>;\n\n/**\n * Deletes all ThunderID session cookies from the browser without contacting the\n * identity server.\n *\n * Use this for error-recovery scenarios where the local session must be wiped\n * immediately: refresh token failures, corrupt sessions, or forced local sign-out\n * when the identity server is unreachable.\n *\n * For a complete sign-out that also revokes the server-side session and obtains the\n * after-sign-out redirect URL, use `signOutAction` instead.\n *\n * @example\n * ```typescript\n * import { clearSession } from '@thunderid/nextjs/server';\n *\n * // Inside a Server Action or Route Handler:\n * await clearSession();\n * redirect('/sign-in');\n * ```\n */\nconst clearSession = async (): Promise<void> => {\n const cookieStore: RequestCookies = await cookies();\n cookieStore.delete(SessionManager.getSessionCookieName());\n cookieStore.delete(SessionManager.getTempSessionCookieName());\n logger.debug('[clearSession] Session cookies cleared.');\n};\n\nexport default clearSession;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,eAAe,YAA2B;CAC9C,MAAMA,cAA8B,MAAM,SAAS;AACnD,aAAY,OAAOC,uBAAe,sBAAsB,CAAC;AACzD,aAAY,OAAOA,uBAAe,0BAA0B,CAAC;AAC7D,gBAAO,MAAM,0CAA0C;;AAGzD,2BAAe"}
@@ -1,20 +1,3 @@
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
1
  /**
19
2
  * Get the access token from the session cookie.
20
3
  *
@@ -1 +1 @@
1
- {"version":3,"file":"getAccessToken.d.ts","sourceRoot":"","sources":["../../../src/server/actions/getAccessToken.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AASH;;;;GAIG;AACH,QAAA,MAAM,cAAc,QAAa,OAAO,CAAC,MAAM,GAAG,SAAS,CAgB1D,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"getAccessToken.d.ts","sourceRoot":"","sources":["../../../src/server/actions/getAccessToken.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,QAAA,MAAM,cAAc,QAAa,OAAO,CAAC,MAAM,GAAG,SAAS,CAgB1D,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getAccessToken.js","names":["sessionToken: string | undefined","SessionManager"],"sources":["../../../src/server/actions/getAccessToken.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n'use server';\n\nimport {cookies} from 'next/headers';\nimport SessionManager, {SessionTokenPayload} from '../../utils/SessionManager';\n\ntype RequestCookies = Awaited<ReturnType<typeof cookies>>;\n\n/**\n * Get the access token from the session cookie.\n *\n * @returns The access token if it exists, undefined otherwise\n */\nconst getAccessToken = async (): Promise<string | undefined> => {\n const cookieStore: RequestCookies = await cookies();\n\n const sessionToken: string | undefined = cookieStore.get(SessionManager.getSessionCookieName())?.value;\n\n if (sessionToken) {\n try {\n const sessionPayload: SessionTokenPayload = await SessionManager.verifySessionToken(sessionToken);\n\n return sessionPayload['accessToken'] as string;\n } catch (error) {\n return undefined;\n }\n }\n\n return undefined;\n};\n\nexport default getAccessToken;\n"],"mappings":";;;;;;;;;;;;AA8BA,MAAM,iBAAiB,YAAyC;CAG9D,MAAMA,gBAF8B,MAAM,SAAS,EAEE,IAAIC,uBAAe,sBAAsB,CAAC,EAAE;AAEjG,KAAI,aACF,KAAI;AAGF,UAF4C,MAAMA,uBAAe,mBAAmB,aAAa,EAE3E;UACf,OAAO;AACd;;;AAON,6BAAe"}
1
+ {"version":3,"file":"getAccessToken.js","names":["sessionToken: string | undefined","SessionManager"],"sources":["../../../src/server/actions/getAccessToken.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n'use server';\n\nimport {cookies} from 'next/headers';\nimport SessionManager, {SessionTokenPayload} from '../../utils/SessionManager';\n\ntype RequestCookies = Awaited<ReturnType<typeof cookies>>;\n\n/**\n * Get the access token from the session cookie.\n *\n * @returns The access token if it exists, undefined otherwise\n */\nconst getAccessToken = async (): Promise<string | undefined> => {\n const cookieStore: RequestCookies = await cookies();\n\n const sessionToken: string | undefined = cookieStore.get(SessionManager.getSessionCookieName())?.value;\n\n if (sessionToken) {\n try {\n const sessionPayload: SessionTokenPayload = await SessionManager.verifySessionToken(sessionToken);\n\n return sessionPayload['accessToken'] as string;\n } catch (error) {\n return undefined;\n }\n }\n\n return undefined;\n};\n\nexport default getAccessToken;\n"],"mappings":";;;;;;;;;;;;AAeA,MAAM,iBAAiB,YAAyC;CAG9D,MAAMA,gBAF8B,MAAM,SAAS,EAEE,IAAIC,uBAAe,sBAAsB,CAAC,EAAE;AAEjG,KAAI,aACF,KAAI;AAGF,UAF4C,MAAMA,uBAAe,mBAAmB,aAAa,EAE3E;UACf,OAAO;AACd;;;AAON,6BAAe"}
@@ -1,20 +1,3 @@
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
1
  declare const getClientOrigin: () => Promise<string>;
19
2
  export default getClientOrigin;
20
3
  //# sourceMappingURL=getClientOrigin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getClientOrigin.d.ts","sourceRoot":"","sources":["../../../src/server/actions/getClientOrigin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAOH,QAAA,MAAM,eAAe,QAAa,OAAO,CAAC,MAAM,CAK/C,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"getClientOrigin.d.ts","sourceRoot":"","sources":["../../../src/server/actions/getClientOrigin.ts"],"names":[],"mappings":"AAQA,QAAA,MAAM,eAAe,QAAa,OAAO,CAAC,MAAM,CAK/C,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getClientOrigin.js","names":["headersList: ReadonlyHeaders","host: string | null"],"sources":["../../../src/server/actions/getClientOrigin.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n'use server';\n\nimport {ReadonlyHeaders} from 'next/dist/server/web/spec-extension/adapters/headers';\nimport {headers} from 'next/headers';\n\nconst getClientOrigin = async (): Promise<string> => {\n const headersList: ReadonlyHeaders = await headers();\n const host: string | null = headersList.get('host');\n const protocol: string = headersList.get('x-forwarded-proto') ?? 'http';\n return `${protocol}://${host}`;\n};\n\nexport default getClientOrigin;\n"],"mappings":";;;;;;AAuBA,MAAM,kBAAkB,YAA6B;CACnD,MAAMA,cAA+B,MAAM,SAAS;CACpD,MAAMC,OAAsB,YAAY,IAAI,OAAO;AAEnD,QAAO,GADkB,YAAY,IAAI,oBAAoB,IAAI,OAC9C,KAAK;;AAG1B,8BAAe"}
1
+ {"version":3,"file":"getClientOrigin.js","names":["headersList: ReadonlyHeaders","host: string | null"],"sources":["../../../src/server/actions/getClientOrigin.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n'use server';\n\nimport {ReadonlyHeaders} from 'next/dist/server/web/spec-extension/adapters/headers';\nimport {headers} from 'next/headers';\n\nconst getClientOrigin = async (): Promise<string> => {\n const headersList: ReadonlyHeaders = await headers();\n const host: string | null = headersList.get('host');\n const protocol: string = headersList.get('x-forwarded-proto') ?? 'http';\n return `${protocol}://${host}`;\n};\n\nexport default getClientOrigin;\n"],"mappings":";;;;;;AAQA,MAAM,kBAAkB,YAA6B;CACnD,MAAMA,cAA+B,MAAM,SAAS;CACpD,MAAMC,OAAsB,YAAY,IAAI,OAAO;AAEnD,QAAO,GADkB,YAAY,IAAI,oBAAoB,IAAI,OAC9C,KAAK;;AAG1B,8BAAe"}
@@ -1,20 +1,3 @@
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
1
  /**
19
2
  * Get the session ID from cookies.
20
3
  * Tries JWT session first, then falls back to legacy session ID.
@@ -1 +1 @@
1
- {"version":3,"file":"getSessionId.d.ts","sourceRoot":"","sources":["../../../src/server/actions/getSessionId.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AASH;;;;;GAKG;AACH,QAAA,MAAM,YAAY,QAAa,OAAO,CAAC,MAAM,GAAG,SAAS,CAgBxD,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"getSessionId.d.ts","sourceRoot":"","sources":["../../../src/server/actions/getSessionId.ts"],"names":[],"mappings":"AAUA;;;;;GAKG;AACH,QAAA,MAAM,YAAY,QAAa,OAAO,CAAC,MAAM,GAAG,SAAS,CAgBxD,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getSessionId.js","names":["sessionToken: string | undefined","SessionManager"],"sources":["../../../src/server/actions/getSessionId.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n'use server';\n\nimport {cookies} from 'next/headers';\nimport SessionManager, {SessionTokenPayload} from '../../utils/SessionManager';\n\ntype RequestCookies = Awaited<ReturnType<typeof cookies>>;\n\n/**\n * Get the session ID from cookies.\n * Tries JWT session first, then falls back to legacy session ID.\n *\n * @returns The session ID if it exists, undefined otherwise\n */\nconst getSessionId = async (): Promise<string | undefined> => {\n const cookieStore: RequestCookies = await cookies();\n\n const sessionToken: string | undefined = cookieStore.get(SessionManager.getSessionCookieName())?.value;\n\n if (sessionToken) {\n try {\n const sessionPayload: SessionTokenPayload = await SessionManager.verifySessionToken(sessionToken);\n\n return sessionPayload.sessionId;\n } catch (error) {\n return undefined;\n }\n }\n\n return undefined;\n};\n\nexport default getSessionId;\n"],"mappings":";;;;;;;;;;;;;AA+BA,MAAM,eAAe,YAAyC;CAG5D,MAAMA,gBAF8B,MAAM,SAAS,EAEE,IAAIC,uBAAe,sBAAsB,CAAC,EAAE;AAEjG,KAAI,aACF,KAAI;AAGF,UAF4C,MAAMA,uBAAe,mBAAmB,aAAa,EAE3E;UACf,OAAO;AACd;;;AAON,2BAAe"}
1
+ {"version":3,"file":"getSessionId.js","names":["sessionToken: string | undefined","SessionManager"],"sources":["../../../src/server/actions/getSessionId.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n'use server';\n\nimport {cookies} from 'next/headers';\nimport SessionManager, {SessionTokenPayload} from '../../utils/SessionManager';\n\ntype RequestCookies = Awaited<ReturnType<typeof cookies>>;\n\n/**\n * Get the session ID from cookies.\n * Tries JWT session first, then falls back to legacy session ID.\n *\n * @returns The session ID if it exists, undefined otherwise\n */\nconst getSessionId = async (): Promise<string | undefined> => {\n const cookieStore: RequestCookies = await cookies();\n\n const sessionToken: string | undefined = cookieStore.get(SessionManager.getSessionCookieName())?.value;\n\n if (sessionToken) {\n try {\n const sessionPayload: SessionTokenPayload = await SessionManager.verifySessionToken(sessionToken);\n\n return sessionPayload.sessionId;\n } catch (error) {\n return undefined;\n }\n }\n\n return undefined;\n};\n\nexport default getSessionId;\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,eAAe,YAAyC;CAG5D,MAAMA,gBAF8B,MAAM,SAAS,EAEE,IAAIC,uBAAe,sBAAsB,CAAC,EAAE;AAEjG,KAAI,aACF,KAAI;AAGF,UAF4C,MAAMA,uBAAe,mBAAmB,aAAa,EAE3E;UACf,OAAO;AACd;;;AAON,2BAAe"}
@@ -1,20 +1,3 @@
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
1
  import { SessionTokenPayload } from '../../utils/SessionManager';
19
2
  /**
20
3
  * Get the session payload from JWT session cookie.
@@ -1 +1 @@
1
- {"version":3,"file":"getSessionPayload.d.ts","sourceRoot":"","sources":["../../../src/server/actions/getSessionPayload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAuB,EAAC,mBAAmB,EAAC,MAAM,4BAA4B,CAAC;AAI/E;;;;;GAKG;AACH,QAAA,MAAM,iBAAiB,QAAa,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAa1E,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"getSessionPayload.d.ts","sourceRoot":"","sources":["../../../src/server/actions/getSessionPayload.ts"],"names":[],"mappings":"AAMA,OAAuB,EAAC,mBAAmB,EAAC,MAAM,4BAA4B,CAAC;AAI/E;;;;;GAKG;AACH,QAAA,MAAM,iBAAiB,QAAa,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAa1E,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getSessionPayload.js","names":["sessionToken: string | undefined","SessionManager"],"sources":["../../../src/server/actions/getSessionPayload.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n'use server';\n\nimport {cookies} from 'next/headers';\nimport SessionManager, {SessionTokenPayload} from '../../utils/SessionManager';\n\ntype RequestCookies = Awaited<ReturnType<typeof cookies>>;\n\n/**\n * Get the session payload from JWT session cookie.\n * This includes user ID, session ID, scopes, and organization ID.\n *\n * @returns The session payload if valid JWT session exists, undefined otherwise\n */\nconst getSessionPayload = async (): Promise<SessionTokenPayload | undefined> => {\n const cookieStore: RequestCookies = await cookies();\n\n const sessionToken: string | undefined = cookieStore.get(SessionManager.getSessionCookieName())?.value;\n if (!sessionToken) {\n return undefined;\n }\n\n try {\n return await SessionManager.verifySessionToken(sessionToken);\n } catch {\n return undefined;\n }\n};\n\nexport default getSessionPayload;\n"],"mappings":";;;;;;;;;;;;;AA+BA,MAAM,oBAAoB,YAAsD;CAG9E,MAAMA,gBAF8B,MAAM,SAAS,EAEE,IAAIC,uBAAe,sBAAsB,CAAC,EAAE;AACjG,KAAI,CAAC,aACH;AAGF,KAAI;AACF,SAAO,MAAMA,uBAAe,mBAAmB,aAAa;SACtD;AACN;;;AAIJ,gCAAe"}
1
+ {"version":3,"file":"getSessionPayload.js","names":["sessionToken: string | undefined","SessionManager"],"sources":["../../../src/server/actions/getSessionPayload.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n'use server';\n\nimport {cookies} from 'next/headers';\nimport SessionManager, {SessionTokenPayload} from '../../utils/SessionManager';\n\ntype RequestCookies = Awaited<ReturnType<typeof cookies>>;\n\n/**\n * Get the session payload from JWT session cookie.\n * This includes user ID, session ID, scopes, and organization ID.\n *\n * @returns The session payload if valid JWT session exists, undefined otherwise\n */\nconst getSessionPayload = async (): Promise<SessionTokenPayload | undefined> => {\n const cookieStore: RequestCookies = await cookies();\n\n const sessionToken: string | undefined = cookieStore.get(SessionManager.getSessionCookieName())?.value;\n if (!sessionToken) {\n return undefined;\n }\n\n try {\n return await SessionManager.verifySessionToken(sessionToken);\n } catch {\n return undefined;\n }\n};\n\nexport default getSessionPayload;\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,oBAAoB,YAAsD;CAG9E,MAAMA,gBAF8B,MAAM,SAAS,EAEE,IAAIC,uBAAe,sBAAsB,CAAC,EAAE;AACjG,KAAI,CAAC,aACH;AAGF,KAAI;AACF,SAAO,MAAMA,uBAAe,mBAAmB,aAAa;SACtD;AACN;;;AAIJ,gCAAe"}
@@ -1,20 +1,3 @@
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
1
  import { User } from '@thunderid/node';
19
2
  /**
20
3
  * Server action to get the current user.
@@ -1 +1 @@
1
- {"version":3,"file":"getUserAction.d.ts","sourceRoot":"","sources":["../../../src/server/actions/getUserAction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAC,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAGrC;;;GAGG;AACH,QAAA,MAAM,aAAa,GACjB,WAAW,MAAM,KAChB,OAAO,CAAC;IAAC,IAAI,EAAE;QAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAA;KAAC,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAC,CAQ7E,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"getUserAction.d.ts","sourceRoot":"","sources":["../../../src/server/actions/getUserAction.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAGrC;;;GAGG;AACH,QAAA,MAAM,aAAa,GACjB,WAAW,MAAM,KAChB,OAAO,CAAC;IAAC,IAAI,EAAE;QAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAA;KAAC,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAC,CAQ7E,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getUserAction.js","names":["getClient"],"sources":["../../../src/server/actions/getUserAction.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n'use server';\n\nimport {User} from '@thunderid/node';\nimport getClient from '../getClient';\n\n/**\n * Server action to get the current user.\n * Returns the user profile if signed in.\n */\nconst getUserAction = async (\n sessionId: string,\n): Promise<{data: {user: User | null}; error: string | null; success: boolean}> => {\n try {\n const client = getClient();\n const user: User = await client.getUser(sessionId);\n return {data: {user}, error: null, success: true};\n } catch (error) {\n return {data: {user: null}, error: 'Failed to get user', success: false};\n }\n};\n\nexport default getUserAction;\n"],"mappings":";;;;;;;;;;AA2BA,MAAM,gBAAgB,OACpB,cACiF;AACjF,KAAI;AAGF,SAAO;GAAC,MAAM,EAAC,MADI,MADJA,mBAAW,CACM,QAAQ,UAAU,EAC9B;GAAE,OAAO;GAAM,SAAS;GAAK;UAC1C,OAAO;AACd,SAAO;GAAC,MAAM,EAAC,MAAM,MAAK;GAAE,OAAO;GAAsB,SAAS;GAAM;;;AAI5E,4BAAe"}
1
+ {"version":3,"file":"getUserAction.js","names":["getClient"],"sources":["../../../src/server/actions/getUserAction.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n'use server';\n\nimport {User} from '@thunderid/node';\nimport getClient from '../getClient';\n\n/**\n * Server action to get the current user.\n * Returns the user profile if signed in.\n */\nconst getUserAction = async (\n sessionId: string,\n): Promise<{data: {user: User | null}; error: string | null; success: boolean}> => {\n try {\n const client = getClient();\n const user: User = await client.getUser(sessionId);\n return {data: {user}, error: null, success: true};\n } catch (error) {\n return {data: {user: null}, error: 'Failed to get user', success: false};\n }\n};\n\nexport default getUserAction;\n"],"mappings":";;;;;;;;;;AAYA,MAAM,gBAAgB,OACpB,cACiF;AACjF,KAAI;AAGF,SAAO;GAAC,MAAM,EAAC,MADI,MADJA,mBAAW,CACM,QAAQ,UAAU,EAC9B;GAAE,OAAO;GAAM,SAAS;GAAK;UAC1C,OAAO;AACd,SAAO;GAAC,MAAM,EAAC,MAAM,MAAK;GAAE,OAAO;GAAsB,SAAS;GAAM;;;AAI5E,4BAAe"}
@@ -1,20 +1,3 @@
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
1
  import { UserProfile } from '@thunderid/node';
19
2
  /**
20
3
  * Server action to get the current user.
@@ -1 +1 @@
1
- {"version":3,"file":"getUserProfileAction.d.ts","sourceRoot":"","sources":["../../../src/server/actions/getUserProfileAction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAG5C;;;GAGG;AACH,QAAA,MAAM,oBAAoB,GACxB,WAAW,MAAM,KAChB,OAAO,CAAC;IAAC,IAAI,EAAE;QAAC,WAAW,EAAE,WAAW,CAAA;KAAC,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAC,CAiBpF,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"getUserProfileAction.d.ts","sourceRoot":"","sources":["../../../src/server/actions/getUserProfileAction.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAG5C;;;GAGG;AACH,QAAA,MAAM,oBAAoB,GACxB,WAAW,MAAM,KAChB,OAAO,CAAC;IAAC,IAAI,EAAE;QAAC,WAAW,EAAE,WAAW,CAAA;KAAC,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAC,CAiBpF,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getUserProfileAction.js","names":["getClient"],"sources":["../../../src/server/actions/getUserProfileAction.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n'use server';\n\nimport {UserProfile} from '@thunderid/node';\nimport getClient from '../getClient';\n\n/**\n * Server action to get the current user.\n * Returns the user profile if signed in.\n */\nconst getUserProfileAction = async (\n sessionId: string,\n): Promise<{data: {userProfile: UserProfile}; error: string | null; success: boolean}> => {\n try {\n const client = getClient();\n const updatedProfile: UserProfile = await client.getUserProfile(sessionId);\n return {data: {userProfile: updatedProfile}, error: null, success: true};\n } catch (error) {\n return {\n data: {\n userProfile: {\n flattenedProfile: {},\n profile: {},\n },\n },\n error: 'Failed to get user profile',\n success: false,\n };\n }\n};\n\nexport default getUserProfileAction;\n"],"mappings":";;;;;;;;;;AA2BA,MAAM,uBAAuB,OAC3B,cACwF;AACxF,KAAI;AAGF,SAAO;GAAC,MAAM,EAAC,aADqB,MADrBA,mBAAW,CACuB,eAAe,UAAU,EAC/B;GAAE,OAAO;GAAM,SAAS;GAAK;UACjE,OAAO;AACd,SAAO;GACL,MAAM,EACJ,aAAa;IACX,kBAAkB,EAAE;IACpB,SAAS,EAAE;IACZ,EACF;GACD,OAAO;GACP,SAAS;GACV;;;AAIL,mCAAe"}
1
+ {"version":3,"file":"getUserProfileAction.js","names":["getClient"],"sources":["../../../src/server/actions/getUserProfileAction.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n'use server';\n\nimport {UserProfile} from '@thunderid/node';\nimport getClient from '../getClient';\n\n/**\n * Server action to get the current user.\n * Returns the user profile if signed in.\n */\nconst getUserProfileAction = async (\n sessionId: string,\n): Promise<{data: {userProfile: UserProfile}; error: string | null; success: boolean}> => {\n try {\n const client = getClient();\n const updatedProfile: UserProfile = await client.getUserProfile(sessionId);\n return {data: {userProfile: updatedProfile}, error: null, success: true};\n } catch (error) {\n return {\n data: {\n userProfile: {\n flattenedProfile: {},\n profile: {},\n },\n },\n error: 'Failed to get user profile',\n success: false,\n };\n }\n};\n\nexport default getUserProfileAction;\n"],"mappings":";;;;;;;;;;AAYA,MAAM,uBAAuB,OAC3B,cACwF;AACxF,KAAI;AAGF,SAAO;GAAC,MAAM,EAAC,aADqB,MADrBA,mBAAW,CACuB,eAAe,UAAU,EAC/B;GAAE,OAAO;GAAM,SAAS;GAAK;UACjE,OAAO;AACd,SAAO;GACL,MAAM,EACJ,aAAa;IACX,kBAAkB,EAAE;IACpB,SAAS,EAAE;IACZ,EACF;GACD,OAAO;GACP,SAAS;GACV;;;AAIL,mCAAe"}
@@ -1,20 +1,3 @@
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
1
  /**
19
2
  * Server action to handle OAuth callback with authorization code.
20
3
  * This action processes the authorization code received from the OAuth provider
@@ -1 +1 @@
1
- {"version":3,"file":"handleOAuthCallbackAction.d.ts","sourceRoot":"","sources":["../../../src/server/actions/handleOAuthCallbackAction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAaH;;;;;;;;;GASG;AACH,QAAA,MAAM,yBAAyB,GAC7B,MAAM,MAAM,EACZ,OAAO,MAAM,EACb,eAAe,MAAM,KACpB,OAAO,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;CAClB,CAyHA,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
1
+ {"version":3,"file":"handleOAuthCallbackAction.d.ts","sourceRoot":"","sources":["../../../src/server/actions/handleOAuthCallbackAction.ts"],"names":[],"mappings":"AAcA;;;;;;;;;GASG;AACH,QAAA,MAAM,yBAAyB,GAC7B,MAAM,MAAM,EACZ,OAAO,MAAM,EACb,eAAe,MAAM,KACpB,OAAO,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;CAClB,CAyHA,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"handleOAuthCallbackAction.js","names":["getClient","cookieStore: RequestCookies","sessionId: string | undefined","tempSessionToken: string | undefined","SessionManager","signInResult: Record<string, unknown>","config: ThunderIDNextConfig","idToken: IdToken","accessToken: string","refreshToken: string","userIdFromToken: string","scopes: string","organizationId: string | undefined","expiresIn: number","sessionCookieExpiryTime: number","sessionToken: string"],"sources":["../../../src/server/actions/handleOAuthCallbackAction.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n'use server';\n\nimport {IdToken} from '@thunderid/node';\nimport {cookies} from 'next/headers';\nimport {ThunderIDNextConfig} from '../../models/config';\nimport logger from '../../utils/logger';\nimport SessionManager from '../../utils/SessionManager';\nimport getClient from '../getClient';\n\ntype RequestCookies = Awaited<ReturnType<typeof cookies>>;\n\n/**\n * Server action to handle OAuth callback with authorization code.\n * This action processes the authorization code received from the OAuth provider\n * and exchanges it for tokens to complete the authentication flow.\n *\n * @param code - Authorization code from OAuth provider\n * @param state - State parameter from OAuth provider for CSRF protection\n * @param sessionState - Session state parameter from OAuth provider\n * @returns Promise that resolves with success status and optional error message\n */\nconst handleOAuthCallbackAction = async (\n code: string,\n state: string,\n sessionState?: string,\n): Promise<{\n error?: string;\n redirectUrl?: string;\n success: boolean;\n}> => {\n try {\n if (!code || !state) {\n return {\n error: 'Missing required OAuth parameters: code and state are required',\n success: false,\n };\n }\n\n const thunderIDClient = getClient();\n\n if (!thunderIDClient.isInitialized) {\n return {\n error: 'ThunderID client is not initialized',\n success: false,\n };\n }\n\n const cookieStore: RequestCookies = await cookies();\n let sessionId: string | undefined;\n\n const tempSessionToken: string | undefined = cookieStore.get(SessionManager.getTempSessionCookieName())?.value;\n\n if (tempSessionToken) {\n try {\n const tempSession: {sessionId: string} = await SessionManager.verifyTempSession(tempSessionToken);\n sessionId = tempSession.sessionId;\n } catch {\n logger.error(\n '[handleOAuthCallbackAction] Invalid temporary session token, falling back to session ID from cookies.',\n );\n }\n }\n\n if (!sessionId) {\n logger.error('[handleOAuthCallbackAction] No session ID found in cookies or temporary session token.');\n\n return {\n error: 'No session found. Please start the authentication flow again.',\n success: false,\n };\n }\n\n // Exchange the authorization code for tokens\n const signInResult: Record<string, unknown> = await thunderIDClient.signIn(\n {\n code,\n session_state: sessionState,\n state,\n } as any,\n {},\n sessionId,\n );\n\n const config: ThunderIDNextConfig = await thunderIDClient.getConfiguration();\n\n if (signInResult) {\n try {\n const idToken: IdToken = await thunderIDClient.getDecodedIdToken(\n sessionId,\n (signInResult['id_token'] || signInResult['idToken']) as string,\n );\n const accessToken: string = (signInResult['accessToken'] || signInResult['access_token']) as string;\n const refreshToken: string = (signInResult['refreshToken'] as string | undefined) ?? '';\n const userIdFromToken: string = (idToken.sub || signInResult['sub'] || sessionId) as string;\n const scopes: string = signInResult['scope'] as string;\n const organizationId: string | undefined = (idToken['user_org'] || idToken['organization_id']) as\n | string\n | undefined;\n const expiresIn: number = signInResult['expiresIn'] as number;\n const sessionCookieExpiryTime: number = SessionManager.resolveSessionCookieExpiry(\n config.sessionCookie?.expiryTime,\n );\n\n const sessionToken: string = await SessionManager.createSessionToken(\n accessToken,\n userIdFromToken,\n sessionId,\n scopes,\n expiresIn,\n refreshToken,\n organizationId,\n );\n\n cookieStore.set(\n SessionManager.getSessionCookieName(),\n sessionToken,\n SessionManager.getSessionCookieOptions(sessionCookieExpiryTime),\n );\n\n cookieStore.delete(SessionManager.getTempSessionCookieName());\n } catch (error) {\n logger.error(\n `[handleOAuthCallbackAction] Failed to create JWT session, continuing with legacy session:\n ${typeof error === 'string' ? error : JSON.stringify(error)}`,\n );\n }\n }\n\n const afterSignInUrl: string = config.afterSignInUrl || '/';\n\n return {\n redirectUrl: afterSignInUrl,\n success: true,\n };\n } catch (error) {\n let errorMessage = 'Authentication failed';\n\n if (error instanceof Error) {\n errorMessage = error.message;\n } else if (error && typeof error === 'object' && 'message' in error) {\n errorMessage = String((error as {message: unknown}).message);\n } else if (typeof error === 'string') {\n errorMessage = error;\n }\n\n return {\n error: errorMessage,\n success: false,\n };\n }\n};\n\nexport default handleOAuthCallbackAction;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAuCA,MAAM,4BAA4B,OAChC,MACA,OACA,iBAKI;AACJ,KAAI;AACF,MAAI,CAAC,QAAQ,CAAC,MACZ,QAAO;GACL,OAAO;GACP,SAAS;GACV;EAGH,MAAM,kBAAkBA,mBAAW;AAEnC,MAAI,CAAC,gBAAgB,cACnB,QAAO;GACL,OAAO;GACP,SAAS;GACV;EAGH,MAAMC,cAA8B,MAAM,SAAS;EACnD,IAAIC;EAEJ,MAAMC,mBAAuC,YAAY,IAAIC,uBAAe,0BAA0B,CAAC,EAAE;AAEzG,MAAI,iBACF,KAAI;AAEF,gBADyC,MAAMA,uBAAe,kBAAkB,iBAAiB,EACzE;UAClB;AACN,kBAAO,MACL,wGACD;;AAIL,MAAI,CAAC,WAAW;AACd,kBAAO,MAAM,yFAAyF;AAEtG,UAAO;IACL,OAAO;IACP,SAAS;IACV;;EAIH,MAAMC,eAAwC,MAAM,gBAAgB,OAClE;GACE;GACA,eAAe;GACf;GACD,EACD,EAAE,EACF,UACD;EAED,MAAMC,SAA8B,MAAM,gBAAgB,kBAAkB;AAE5E,MAAI,aACF,KAAI;GACF,MAAMC,UAAmB,MAAM,gBAAgB,kBAC7C,WACC,aAAa,eAAe,aAAa,WAC3C;GACD,MAAMC,cAAuB,aAAa,kBAAkB,aAAa;GACzE,MAAMC,eAAwB,aAAa,mBAA0C;GACrF,MAAMC,kBAA2B,QAAQ,OAAO,aAAa,UAAU;GACvE,MAAMC,SAAiB,aAAa;GACpC,MAAMC,iBAAsC,QAAQ,eAAe,QAAQ;GAG3E,MAAMC,YAAoB,aAAa;GACvC,MAAMC,0BAAkCV,uBAAe,2BACrD,OAAO,eAAe,WACvB;GAED,MAAMW,eAAuB,MAAMX,uBAAe,mBAChD,aACA,iBACA,WACA,QACA,WACA,cACA,eACD;AAED,eAAY,IACVA,uBAAe,sBAAsB,EACrC,cACAA,uBAAe,wBAAwB,wBAAwB,CAChE;AAED,eAAY,OAAOA,uBAAe,0BAA0B,CAAC;WACtD,OAAO;AACd,kBAAO,MACL;YACE,OAAO,UAAU,WAAW,QAAQ,KAAK,UAAU,MAAM,GAC5D;;AAML,SAAO;GACL,aAH6B,OAAO,kBAAkB;GAItD,SAAS;GACV;UACM,OAAO;EACd,IAAI,eAAe;AAEnB,MAAI,iBAAiB,MACnB,gBAAe,MAAM;WACZ,SAAS,OAAO,UAAU,YAAY,aAAa,MAC5D,gBAAe,OAAQ,MAA6B,QAAQ;WACnD,OAAO,UAAU,SAC1B,gBAAe;AAGjB,SAAO;GACL,OAAO;GACP,SAAS;GACV;;;AAIL,wCAAe"}
1
+ {"version":3,"file":"handleOAuthCallbackAction.js","names":["getClient","cookieStore: RequestCookies","sessionId: string | undefined","tempSessionToken: string | undefined","SessionManager","signInResult: Record<string, unknown>","config: ThunderIDNextConfig","idToken: IdToken","accessToken: string","refreshToken: string","userIdFromToken: string","scopes: string","organizationId: string | undefined","expiresIn: number","sessionCookieExpiryTime: number","sessionToken: string"],"sources":["../../../src/server/actions/handleOAuthCallbackAction.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n'use server';\n\nimport {IdToken} from '@thunderid/node';\nimport {cookies} from 'next/headers';\nimport {ThunderIDNextConfig} from '../../models/config';\nimport logger from '../../utils/logger';\nimport SessionManager from '../../utils/SessionManager';\nimport getClient from '../getClient';\n\ntype RequestCookies = Awaited<ReturnType<typeof cookies>>;\n\n/**\n * Server action to handle OAuth callback with authorization code.\n * This action processes the authorization code received from the OAuth provider\n * and exchanges it for tokens to complete the authentication flow.\n *\n * @param code - Authorization code from OAuth provider\n * @param state - State parameter from OAuth provider for CSRF protection\n * @param sessionState - Session state parameter from OAuth provider\n * @returns Promise that resolves with success status and optional error message\n */\nconst handleOAuthCallbackAction = async (\n code: string,\n state: string,\n sessionState?: string,\n): Promise<{\n error?: string;\n redirectUrl?: string;\n success: boolean;\n}> => {\n try {\n if (!code || !state) {\n return {\n error: 'Missing required OAuth parameters: code and state are required',\n success: false,\n };\n }\n\n const thunderIDClient = getClient();\n\n if (!thunderIDClient.isInitialized) {\n return {\n error: 'ThunderID client is not initialized',\n success: false,\n };\n }\n\n const cookieStore: RequestCookies = await cookies();\n let sessionId: string | undefined;\n\n const tempSessionToken: string | undefined = cookieStore.get(SessionManager.getTempSessionCookieName())?.value;\n\n if (tempSessionToken) {\n try {\n const tempSession: {sessionId: string} = await SessionManager.verifyTempSession(tempSessionToken);\n sessionId = tempSession.sessionId;\n } catch {\n logger.error(\n '[handleOAuthCallbackAction] Invalid temporary session token, falling back to session ID from cookies.',\n );\n }\n }\n\n if (!sessionId) {\n logger.error('[handleOAuthCallbackAction] No session ID found in cookies or temporary session token.');\n\n return {\n error: 'No session found. Please start the authentication flow again.',\n success: false,\n };\n }\n\n // Exchange the authorization code for tokens\n const signInResult: Record<string, unknown> = await thunderIDClient.signIn(\n {\n code,\n session_state: sessionState,\n state,\n } as any,\n {},\n sessionId,\n );\n\n const config: ThunderIDNextConfig = await thunderIDClient.getConfiguration();\n\n if (signInResult) {\n try {\n const idToken: IdToken = await thunderIDClient.getDecodedIdToken(\n sessionId,\n (signInResult['id_token'] || signInResult['idToken']) as string,\n );\n const accessToken: string = (signInResult['accessToken'] || signInResult['access_token']) as string;\n const refreshToken: string = (signInResult['refreshToken'] as string | undefined) ?? '';\n const userIdFromToken: string = (idToken.sub || signInResult['sub'] || sessionId) as string;\n const scopes: string = signInResult['scope'] as string;\n const organizationId: string | undefined = (idToken['user_org'] || idToken['organization_id']) as\n | string\n | undefined;\n const expiresIn: number = signInResult['expiresIn'] as number;\n const sessionCookieExpiryTime: number = SessionManager.resolveSessionCookieExpiry(\n config.sessionCookie?.expiryTime,\n );\n\n const sessionToken: string = await SessionManager.createSessionToken(\n accessToken,\n userIdFromToken,\n sessionId,\n scopes,\n expiresIn,\n refreshToken,\n organizationId,\n );\n\n cookieStore.set(\n SessionManager.getSessionCookieName(),\n sessionToken,\n SessionManager.getSessionCookieOptions(sessionCookieExpiryTime),\n );\n\n cookieStore.delete(SessionManager.getTempSessionCookieName());\n } catch (error) {\n logger.error(\n `[handleOAuthCallbackAction] Failed to create JWT session, continuing with legacy session:\n ${typeof error === 'string' ? error : JSON.stringify(error)}`,\n );\n }\n }\n\n const afterSignInUrl: string = config.afterSignInUrl || '/';\n\n return {\n redirectUrl: afterSignInUrl,\n success: true,\n };\n } catch (error) {\n let errorMessage = 'Authentication failed';\n\n if (error instanceof Error) {\n errorMessage = error.message;\n } else if (error && typeof error === 'object' && 'message' in error) {\n errorMessage = String((error as {message: unknown}).message);\n } else if (typeof error === 'string') {\n errorMessage = error;\n }\n\n return {\n error: errorMessage,\n success: false,\n };\n }\n};\n\nexport default handleOAuthCallbackAction;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAwBA,MAAM,4BAA4B,OAChC,MACA,OACA,iBAKI;AACJ,KAAI;AACF,MAAI,CAAC,QAAQ,CAAC,MACZ,QAAO;GACL,OAAO;GACP,SAAS;GACV;EAGH,MAAM,kBAAkBA,mBAAW;AAEnC,MAAI,CAAC,gBAAgB,cACnB,QAAO;GACL,OAAO;GACP,SAAS;GACV;EAGH,MAAMC,cAA8B,MAAM,SAAS;EACnD,IAAIC;EAEJ,MAAMC,mBAAuC,YAAY,IAAIC,uBAAe,0BAA0B,CAAC,EAAE;AAEzG,MAAI,iBACF,KAAI;AAEF,gBADyC,MAAMA,uBAAe,kBAAkB,iBAAiB,EACzE;UAClB;AACN,kBAAO,MACL,wGACD;;AAIL,MAAI,CAAC,WAAW;AACd,kBAAO,MAAM,yFAAyF;AAEtG,UAAO;IACL,OAAO;IACP,SAAS;IACV;;EAIH,MAAMC,eAAwC,MAAM,gBAAgB,OAClE;GACE;GACA,eAAe;GACf;GACD,EACD,EAAE,EACF,UACD;EAED,MAAMC,SAA8B,MAAM,gBAAgB,kBAAkB;AAE5E,MAAI,aACF,KAAI;GACF,MAAMC,UAAmB,MAAM,gBAAgB,kBAC7C,WACC,aAAa,eAAe,aAAa,WAC3C;GACD,MAAMC,cAAuB,aAAa,kBAAkB,aAAa;GACzE,MAAMC,eAAwB,aAAa,mBAA0C;GACrF,MAAMC,kBAA2B,QAAQ,OAAO,aAAa,UAAU;GACvE,MAAMC,SAAiB,aAAa;GACpC,MAAMC,iBAAsC,QAAQ,eAAe,QAAQ;GAG3E,MAAMC,YAAoB,aAAa;GACvC,MAAMC,0BAAkCV,uBAAe,2BACrD,OAAO,eAAe,WACvB;GAED,MAAMW,eAAuB,MAAMX,uBAAe,mBAChD,aACA,iBACA,WACA,QACA,WACA,cACA,eACD;AAED,eAAY,IACVA,uBAAe,sBAAsB,EACrC,cACAA,uBAAe,wBAAwB,wBAAwB,CAChE;AAED,eAAY,OAAOA,uBAAe,0BAA0B,CAAC;WACtD,OAAO;AACd,kBAAO,MACL;YACE,OAAO,UAAU,WAAW,QAAQ,KAAK,UAAU,MAAM,GAC5D;;AAML,SAAO;GACL,aAH6B,OAAO,kBAAkB;GAItD,SAAS;GACV;UACM,OAAO;EACd,IAAI,eAAe;AAEnB,MAAI,iBAAiB,MACnB,gBAAe,MAAM;WACZ,SAAS,OAAO,UAAU,YAAY,aAAa,MAC5D,gBAAe,OAAQ,MAA6B,QAAQ;WACnD,OAAO,UAAU,SAC1B,gBAAe;AAGjB,SAAO;GACL,OAAO;GACP,SAAS;GACV;;;AAIL,wCAAe"}
@@ -1,20 +1,3 @@
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
1
  /**
19
2
  * Check if the user is currently signed in.
20
3
  *
@@ -1 +1 @@
1
- {"version":3,"file":"isSignedIn.d.ts","sourceRoot":"","sources":["../../../src/server/actions/isSignedIn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AASH;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,UAAU,GAAU,YAAY,MAAM,KAAG,OAAO,CAAC,OAAO,CA0B7D,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"isSignedIn.d.ts","sourceRoot":"","sources":["../../../src/server/actions/isSignedIn.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,UAAU,GAAU,YAAY,MAAM,KAAG,OAAO,CAAC,OAAO,CA0B7D,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"isSignedIn.js","names":["getSessionPayload","resolvedSessionId: string | undefined","getSessionId","getClient"],"sources":["../../../src/server/actions/isSignedIn.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n'use server';\n\nimport getSessionId from './getSessionId';\nimport getSessionPayload from './getSessionPayload';\nimport {SessionTokenPayload} from '../../utils/SessionManager';\nimport getClient from '../getClient';\n\n/**\n * Check if the user is currently signed in.\n *\n * For JWT-based sessions: the session JWT exp claim is now tied to the access\n * token expiry. A successful jwtVerify (inside getSessionPayload) already proves\n * exp > now, so no separate timestamp comparison is needed here.\n *\n * Falls back to the legacy SDK in-memory check when no JWT session cookie exists.\n *\n * @param sessionId - Optional session ID (used only for the legacy fallback path)\n * @returns True if the user is signed in with a valid, non-expired token\n */\nconst isSignedIn = async (sessionId?: string): Promise<boolean> => {\n try {\n const sessionPayload: SessionTokenPayload | undefined = await getSessionPayload();\n\n if (sessionPayload) {\n return true;\n }\n\n // No JWT session — fall back to the legacy SDK in-memory store check.\n const resolvedSessionId: string | undefined = sessionId || (await getSessionId());\n\n if (!resolvedSessionId) {\n return false;\n }\n\n const client = getClient();\n\n try {\n const accessToken: string = await client.getAccessToken(resolvedSessionId);\n return !!accessToken;\n } catch {\n return false;\n }\n } catch {\n return false;\n }\n};\n\nexport default isSignedIn;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqCA,MAAM,aAAa,OAAO,cAAyC;AACjE,KAAI;AAGF,MAFwD,MAAMA,2BAAmB,CAG/E,QAAO;EAIT,MAAMC,oBAAwC,aAAc,MAAMC,sBAAc;AAEhF,MAAI,CAAC,kBACH,QAAO;EAGT,MAAM,SAASC,mBAAW;AAE1B,MAAI;AAEF,UAAO,CAAC,CADoB,MAAM,OAAO,eAAe,kBAAkB;UAEpE;AACN,UAAO;;SAEH;AACN,SAAO;;;AAIX,yBAAe"}
1
+ {"version":3,"file":"isSignedIn.js","names":["getSessionPayload","resolvedSessionId: string | undefined","getSessionId","getClient"],"sources":["../../../src/server/actions/isSignedIn.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n'use server';\n\nimport getSessionId from './getSessionId';\nimport getSessionPayload from './getSessionPayload';\nimport {SessionTokenPayload} from '../../utils/SessionManager';\nimport getClient from '../getClient';\n\n/**\n * Check if the user is currently signed in.\n *\n * For JWT-based sessions: the session JWT exp claim is now tied to the access\n * token expiry. A successful jwtVerify (inside getSessionPayload) already proves\n * exp > now, so no separate timestamp comparison is needed here.\n *\n * Falls back to the legacy SDK in-memory check when no JWT session cookie exists.\n *\n * @param sessionId - Optional session ID (used only for the legacy fallback path)\n * @returns True if the user is signed in with a valid, non-expired token\n */\nconst isSignedIn = async (sessionId?: string): Promise<boolean> => {\n try {\n const sessionPayload: SessionTokenPayload | undefined = await getSessionPayload();\n\n if (sessionPayload) {\n return true;\n }\n\n // No JWT session — fall back to the legacy SDK in-memory store check.\n const resolvedSessionId: string | undefined = sessionId || (await getSessionId());\n\n if (!resolvedSessionId) {\n return false;\n }\n\n const client = getClient();\n\n try {\n const accessToken: string = await client.getAccessToken(resolvedSessionId);\n return !!accessToken;\n } catch {\n return false;\n }\n } catch {\n return false;\n }\n};\n\nexport default isSignedIn;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,aAAa,OAAO,cAAyC;AACjE,KAAI;AAGF,MAFwD,MAAMA,2BAAmB,CAG/E,QAAO;EAIT,MAAMC,oBAAwC,aAAc,MAAMC,sBAAc;AAEhF,MAAI,CAAC,kBACH,QAAO;EAGT,MAAM,SAASC,mBAAW;AAE1B,MAAI;AAEF,UAAO,CAAC,CADoB,MAAM,OAAO,eAAe,kBAAkB;UAEpE;AACN,UAAO;;SAEH;AACN,SAAO;;;AAIX,yBAAe"}
@@ -1,20 +1,3 @@
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
1
  /**
19
2
  * Client-safe result of a token refresh.
20
3
  *
@@ -1 +1 @@
1
- {"version":3,"file":"refreshToken.d.ts","sourceRoot":"","sources":["../../../src/server/actions/refreshToken.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAaH;;;;;;;;;;GAUG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;GAUG;AACH,QAAA,MAAM,YAAY,QAAa,OAAO,CAAC,aAAa,CAmEnD,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"refreshToken.d.ts","sourceRoot":"","sources":["../../../src/server/actions/refreshToken.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;GAUG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;GAUG;AACH,QAAA,MAAM,YAAY,QAAa,OAAO,CAAC,aAAa,CAmEnD,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"refreshToken.js","names":["cookieStore: RequestCookies","sessionToken: string | undefined","SessionManager","sessionPayload: SessionTokenPayload","config: ThunderIDNextConfig","getClient","result: HandleRefreshTokenResult","handleRefreshToken","rawExpiresIn: string | undefined","expiresInSeconds: number","expiresAt: number"],"sources":["../../../src/server/actions/refreshToken.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n'use server';\n\nimport {ThunderIDAPIError, logger} from '@thunderid/node';\nimport {cookies} from 'next/headers';\nimport {ThunderIDNextConfig} from '../../models/config';\nimport handleRefreshToken, {HandleRefreshTokenResult} from '../../utils/handleRefreshToken';\nimport SessionManager, {SessionTokenPayload} from '../../utils/SessionManager';\nimport getClient from '../getClient';\n\ntype RequestCookies = Awaited<ReturnType<typeof cookies>>;\n\n/**\n * Client-safe result of a token refresh.\n *\n * Intentionally omits accessToken, refreshToken, idToken, and scopes — those stay\n * server-side in the HttpOnly session cookie. Returning tokens from a Server Action\n * serializes them into browser memory, defeating the HttpOnly boundary and exposing\n * them to XSS, browser extensions, and error-tracking SDKs.\n *\n * `expiresAt` is epoch seconds for the new access token; the client uses it to\n * schedule the next refresh.\n */\nexport interface RefreshResult {\n expiresAt: number;\n}\n\n/**\n * Server action to refresh the access token using the stored refresh token.\n * Exchanges the refresh token for a new token set and updates the session cookie.\n *\n * Delegates the HTTP exchange to handleRefreshToken so the same logic is shared\n * with the middleware token refresh path.\n *\n * Called from the client side (e.g. ThunderIDClientProvider refreshOnMount) where\n * Next.js allows cookie mutation. When invoked during SSR rendering the cookie\n * write is silently skipped and a warning is logged.\n */\nconst refreshToken = async (): Promise<RefreshResult> => {\n try {\n const cookieStore: RequestCookies = await cookies();\n const sessionToken: string | undefined = cookieStore.get(SessionManager.getSessionCookieName())?.value;\n\n if (!sessionToken) {\n throw new ThunderIDAPIError(\n 'No active session found. User must be signed in to refresh the token.',\n 'refreshToken-ServerActionError-002',\n 'nextjs',\n 401,\n );\n }\n\n const sessionPayload: SessionTokenPayload = await SessionManager.verifySessionTokenForRefresh(sessionToken);\n const client = getClient();\n const config: ThunderIDNextConfig = await client.getConfiguration();\n\n const result: HandleRefreshTokenResult = await handleRefreshToken(sessionPayload, {\n baseUrl: config.baseUrl ?? '',\n clientId: config.clientId ?? '',\n clientSecret: config.clientSecret ?? '',\n sessionCookie: config.sessionCookie,\n });\n\n try {\n cookieStore.set(\n SessionManager.getSessionCookieName(),\n result.newSessionToken,\n SessionManager.getSessionCookieOptions(result.sessionCookieExpiryTime),\n );\n } catch {\n // cookies().set() is only permitted inside a Server Action invoked from the client\n // or a Route Handler. When this action is called during SSR rendering the write\n // is blocked by Next.js. The middleware refresh path handles that case instead.\n logger.warn('[refreshToken] Could not write session cookie — called from SSR rendering context.');\n }\n\n const rawExpiresIn: string | undefined = result.tokenResponse.expiresIn;\n const expiresInSeconds: number = parseInt(rawExpiresIn ?? '', 10);\n if (Number.isNaN(expiresInSeconds)) {\n throw new Error(`[refreshToken] Invalid expiresIn value received: ${rawExpiresIn}`);\n }\n const expiresAt: number = Math.floor(Date.now() / 1000) + expiresInSeconds;\n\n logger.debug('[refreshToken] Token refresh succeeded.');\n return {expiresAt};\n } catch (error) {\n // Clear the dead session cookie before throwing so the browser is not left\n // holding a stale credential. This is best-effort — if called from an SSR\n // rendering context Next.js blocks cookie mutation; the middleware cleanup\n // path covers that case on the next request.\n try {\n const cookieStore: RequestCookies = await cookies();\n cookieStore.delete(SessionManager.getSessionCookieName());\n logger.debug('[refreshToken] Cleared session cookie after refresh failure.');\n } catch {\n // Intentionally swallowed — middleware handles cleanup when mutation is blocked.\n }\n\n throw new ThunderIDAPIError(\n `Failed to refresh the session: ${error instanceof Error ? error.message : JSON.stringify(error)}`,\n 'refreshToken-ServerActionError-001',\n 'nextjs',\n error instanceof ThunderIDAPIError ? error.statusCode : undefined,\n );\n }\n};\n\nexport default refreshToken;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuDA,MAAM,eAAe,YAAoC;AACvD,KAAI;EACF,MAAMA,cAA8B,MAAM,SAAS;EACnD,MAAMC,eAAmC,YAAY,IAAIC,uBAAe,sBAAsB,CAAC,EAAE;AAEjG,MAAI,CAAC,aACH,OAAM,IAAI,kBACR,yEACA,sCACA,UACA,IACD;EAGH,MAAMC,iBAAsC,MAAMD,uBAAe,6BAA6B,aAAa;EAE3G,MAAME,SAA8B,MADrBC,mBAAW,CACuB,kBAAkB;EAEnE,MAAMC,SAAmC,MAAMC,2BAAmB,gBAAgB;GAChF,SAAS,OAAO,WAAW;GAC3B,UAAU,OAAO,YAAY;GAC7B,cAAc,OAAO,gBAAgB;GACrC,eAAe,OAAO;GACvB,CAAC;AAEF,MAAI;AACF,eAAY,IACVL,uBAAe,sBAAsB,EACrC,OAAO,iBACPA,uBAAe,wBAAwB,OAAO,wBAAwB,CACvE;UACK;AAIN,UAAO,KAAK,qFAAqF;;EAGnG,MAAMM,eAAmC,OAAO,cAAc;EAC9D,MAAMC,mBAA2B,SAAS,gBAAgB,IAAI,GAAG;AACjE,MAAI,OAAO,MAAM,iBAAiB,CAChC,OAAM,IAAI,MAAM,oDAAoD,eAAe;EAErF,MAAMC,YAAoB,KAAK,MAAM,KAAK,KAAK,GAAG,IAAK,GAAG;AAE1D,SAAO,MAAM,0CAA0C;AACvD,SAAO,EAAC,WAAU;UACX,OAAO;AAKd,MAAI;AAEF,IADoC,MAAM,SAAS,EACvC,OAAOR,uBAAe,sBAAsB,CAAC;AACzD,UAAO,MAAM,+DAA+D;UACtE;AAIR,QAAM,IAAI,kBACR,kCAAkC,iBAAiB,QAAQ,MAAM,UAAU,KAAK,UAAU,MAAM,IAChG,sCACA,UACA,iBAAiB,oBAAoB,MAAM,aAAa,OACzD;;;AAIL,2BAAe"}
1
+ {"version":3,"file":"refreshToken.js","names":["cookieStore: RequestCookies","sessionToken: string | undefined","SessionManager","sessionPayload: SessionTokenPayload","config: ThunderIDNextConfig","getClient","result: HandleRefreshTokenResult","handleRefreshToken","rawExpiresIn: string | undefined","expiresInSeconds: number","expiresAt: number"],"sources":["../../../src/server/actions/refreshToken.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n'use server';\n\nimport {ThunderIDAPIError, logger} from '@thunderid/node';\nimport {cookies} from 'next/headers';\nimport {ThunderIDNextConfig} from '../../models/config';\nimport handleRefreshToken, {HandleRefreshTokenResult} from '../../utils/handleRefreshToken';\nimport SessionManager, {SessionTokenPayload} from '../../utils/SessionManager';\nimport getClient from '../getClient';\n\ntype RequestCookies = Awaited<ReturnType<typeof cookies>>;\n\n/**\n * Client-safe result of a token refresh.\n *\n * Intentionally omits accessToken, refreshToken, idToken, and scopes — those stay\n * server-side in the HttpOnly session cookie. Returning tokens from a Server Action\n * serializes them into browser memory, defeating the HttpOnly boundary and exposing\n * them to XSS, browser extensions, and error-tracking SDKs.\n *\n * `expiresAt` is epoch seconds for the new access token; the client uses it to\n * schedule the next refresh.\n */\nexport interface RefreshResult {\n expiresAt: number;\n}\n\n/**\n * Server action to refresh the access token using the stored refresh token.\n * Exchanges the refresh token for a new token set and updates the session cookie.\n *\n * Delegates the HTTP exchange to handleRefreshToken so the same logic is shared\n * with the middleware token refresh path.\n *\n * Called from the client side (e.g. ThunderIDClientProvider refreshOnMount) where\n * Next.js allows cookie mutation. When invoked during SSR rendering the cookie\n * write is silently skipped and a warning is logged.\n */\nconst refreshToken = async (): Promise<RefreshResult> => {\n try {\n const cookieStore: RequestCookies = await cookies();\n const sessionToken: string | undefined = cookieStore.get(SessionManager.getSessionCookieName())?.value;\n\n if (!sessionToken) {\n throw new ThunderIDAPIError(\n 'No active session found. User must be signed in to refresh the token.',\n 'refreshToken-ServerActionError-002',\n 'nextjs',\n 401,\n );\n }\n\n const sessionPayload: SessionTokenPayload = await SessionManager.verifySessionTokenForRefresh(sessionToken);\n const client = getClient();\n const config: ThunderIDNextConfig = await client.getConfiguration();\n\n const result: HandleRefreshTokenResult = await handleRefreshToken(sessionPayload, {\n baseUrl: config.baseUrl ?? '',\n clientId: config.clientId ?? '',\n clientSecret: config.clientSecret ?? '',\n sessionCookie: config.sessionCookie,\n });\n\n try {\n cookieStore.set(\n SessionManager.getSessionCookieName(),\n result.newSessionToken,\n SessionManager.getSessionCookieOptions(result.sessionCookieExpiryTime),\n );\n } catch {\n // cookies().set() is only permitted inside a Server Action invoked from the client\n // or a Route Handler. When this action is called during SSR rendering the write\n // is blocked by Next.js. The middleware refresh path handles that case instead.\n logger.warn('[refreshToken] Could not write session cookie — called from SSR rendering context.');\n }\n\n const rawExpiresIn: string | undefined = result.tokenResponse.expiresIn;\n const expiresInSeconds: number = parseInt(rawExpiresIn ?? '', 10);\n if (Number.isNaN(expiresInSeconds)) {\n throw new Error(`[refreshToken] Invalid expiresIn value received: ${rawExpiresIn}`);\n }\n const expiresAt: number = Math.floor(Date.now() / 1000) + expiresInSeconds;\n\n logger.debug('[refreshToken] Token refresh succeeded.');\n return {expiresAt};\n } catch (error) {\n // Clear the dead session cookie before throwing so the browser is not left\n // holding a stale credential. This is best-effort — if called from an SSR\n // rendering context Next.js blocks cookie mutation; the middleware cleanup\n // path covers that case on the next request.\n try {\n const cookieStore: RequestCookies = await cookies();\n cookieStore.delete(SessionManager.getSessionCookieName());\n logger.debug('[refreshToken] Cleared session cookie after refresh failure.');\n } catch {\n // Intentionally swallowed — middleware handles cleanup when mutation is blocked.\n }\n\n throw new ThunderIDAPIError(\n `Failed to refresh the session: ${error instanceof Error ? error.message : JSON.stringify(error)}`,\n 'refreshToken-ServerActionError-001',\n 'nextjs',\n error instanceof ThunderIDAPIError ? error.statusCode : undefined,\n );\n }\n};\n\nexport default refreshToken;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwCA,MAAM,eAAe,YAAoC;AACvD,KAAI;EACF,MAAMA,cAA8B,MAAM,SAAS;EACnD,MAAMC,eAAmC,YAAY,IAAIC,uBAAe,sBAAsB,CAAC,EAAE;AAEjG,MAAI,CAAC,aACH,OAAM,IAAI,kBACR,yEACA,sCACA,UACA,IACD;EAGH,MAAMC,iBAAsC,MAAMD,uBAAe,6BAA6B,aAAa;EAE3G,MAAME,SAA8B,MADrBC,mBAAW,CACuB,kBAAkB;EAEnE,MAAMC,SAAmC,MAAMC,2BAAmB,gBAAgB;GAChF,SAAS,OAAO,WAAW;GAC3B,UAAU,OAAO,YAAY;GAC7B,cAAc,OAAO,gBAAgB;GACrC,eAAe,OAAO;GACvB,CAAC;AAEF,MAAI;AACF,eAAY,IACVL,uBAAe,sBAAsB,EACrC,OAAO,iBACPA,uBAAe,wBAAwB,OAAO,wBAAwB,CACvE;UACK;AAIN,UAAO,KAAK,qFAAqF;;EAGnG,MAAMM,eAAmC,OAAO,cAAc;EAC9D,MAAMC,mBAA2B,SAAS,gBAAgB,IAAI,GAAG;AACjE,MAAI,OAAO,MAAM,iBAAiB,CAChC,OAAM,IAAI,MAAM,oDAAoD,eAAe;EAErF,MAAMC,YAAoB,KAAK,MAAM,KAAK,KAAK,GAAG,IAAK,GAAG;AAE1D,SAAO,MAAM,0CAA0C;AACvD,SAAO,EAAC,WAAU;UACX,OAAO;AAKd,MAAI;AAEF,IADoC,MAAM,SAAS,EACvC,OAAOR,uBAAe,sBAAsB,CAAC;AACzD,UAAO,MAAM,+DAA+D;UACtE;AAIR,QAAM,IAAI,kBACR,kCAAkC,iBAAiB,QAAQ,MAAM,UAAU,KAAK,UAAU,MAAM,IAChG,sCACA,UACA,iBAAiB,oBAAoB,MAAM,aAAa,OACzD;;;AAIL,2BAAe"}
@@ -1,20 +1,3 @@
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
1
  import { EmbeddedFlowExecuteRequestConfig } from '@thunderid/node';
19
2
  /**
20
3
  * Server action for signing in a user.
@@ -1 +1 @@
1
- {"version":3,"file":"signInAction.d.ts","sourceRoot":"","sources":["../../../src/server/actions/signInAction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAGL,gCAAgC,EAGjC,MAAM,iBAAiB,CAAC;AASzB;;;;;;;GAOG;AACH,QAAA,MAAM,YAAY,GAChB,UAAU,GAAG,EACb,UAAU,gCAAgC,KACzC,OAAO,CAAC;IACT,IAAI,CAAC,EACD;QACE,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GACD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB,CA6GA,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"signInAction.d.ts","sourceRoot":"","sources":["../../../src/server/actions/signInAction.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,gCAAgC,EAGjC,MAAM,iBAAiB,CAAC;AASzB;;;;;;;GAOG;AACH,QAAA,MAAM,YAAY,GAChB,UAAU,GAAG,EACb,UAAU,gCAAgC,KACzC,OAAO,CAAC;IACT,IAAI,CAAC,EACD;QACE,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GACD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB,CA6GA,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"signInAction.js","names":["getClient","cookieStore: RequestCookies","sessionId: string | undefined","existingSessionToken: string | undefined","SessionManager","tempSessionToken: string | undefined","tempSessionToken: string","defaultSignInUrl: string","response: any","idToken: IdToken","userIdFromToken: string","organizationId: string | undefined","scopes: string","iat: number","exp: number","expiresIn: number","config: ThunderIDNextConfig","sessionCookieExpiryTime: number","sessionToken: string","afterSignInUrl: string"],"sources":["../../../src/server/actions/signInAction.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n'use server';\n\nimport {\n generateSessionId,\n EmbeddedSignInFlowStatus,\n EmbeddedFlowExecuteRequestConfig,\n IdToken,\n isEmpty,\n} from '@thunderid/node';\nimport {cookies} from 'next/headers';\nimport {ThunderIDNextConfig} from '../../models/config';\nimport logger from '../../utils/logger';\nimport SessionManager, {SessionTokenPayload} from '../../utils/SessionManager';\nimport getClient from '../getClient';\n\ntype RequestCookies = Awaited<ReturnType<typeof cookies>>;\n\n/**\n * Server action for signing in a user.\n * Handles the embedded sign-in flow and manages session cookies.\n *\n * @param payload - The embedded sign-in flow payload\n * @param request - The embedded flow execute request config\n * @returns Promise that resolves when sign-in is complete\n */\nconst signInAction = async (\n payload?: any,\n request?: EmbeddedFlowExecuteRequestConfig,\n): Promise<{\n data?:\n | {\n afterSignInUrl?: string;\n signInUrl?: string;\n }\n | Record<string, unknown>;\n error?: string;\n success: boolean;\n}> => {\n try {\n const client = getClient();\n const cookieStore: RequestCookies = await cookies();\n\n let sessionId: string | undefined;\n\n const existingSessionToken: string | undefined = cookieStore.get(SessionManager.getSessionCookieName())?.value;\n\n if (existingSessionToken) {\n try {\n const sessionPayload: SessionTokenPayload = await SessionManager.verifySessionToken(existingSessionToken);\n sessionId = sessionPayload.sessionId;\n } catch {\n // Invalid session token, will create new temp session\n }\n }\n\n if (!sessionId) {\n const tempSessionToken: string | undefined = cookieStore.get(SessionManager.getTempSessionCookieName())?.value;\n\n if (tempSessionToken) {\n try {\n const tempSession: {sessionId: string} = await SessionManager.verifyTempSession(tempSessionToken);\n sessionId = tempSession.sessionId;\n } catch {\n // Invalid temp session, will create new one\n }\n }\n }\n\n if (!sessionId) {\n sessionId = generateSessionId();\n\n const tempSessionToken: string = await SessionManager.createTempSession(sessionId);\n\n cookieStore.set(\n SessionManager.getTempSessionCookieName(),\n tempSessionToken,\n SessionManager.getTempSessionCookieOptions(),\n );\n }\n\n // If no payload provided, redirect to sign-in URL for redirect-based sign-in.\n if (!payload || isEmpty(payload)) {\n const defaultSignInUrl: string = await client.getAuthorizeRequestUrl({}, sessionId);\n return {data: {signInUrl: String(defaultSignInUrl)}, success: true};\n }\n\n // Handle embedded sign-in flow\n const response: any = await client.signIn(payload, request!, sessionId);\n\n if (response.flowStatus === EmbeddedSignInFlowStatus.Complete) {\n // On the V2 platform, a completed embedded flow (without a preceding `/authorize` redirect,\n // i.e. no `authId`) returns a self-contained JWT `assertion` rather than an authorization\n // code to exchange. This mirrors how @thunderid/react and @thunderid/vue treat it: the\n // assertion is used directly as the bearer session token.\n if (!response.assertion) {\n throw new Error('[signInAction] Flow completed without an assertion.');\n }\n\n const idToken: IdToken = await client.getDecodedIdToken(sessionId, response.assertion);\n const userIdFromToken: string = (idToken.sub as string | undefined) ?? sessionId;\n const organizationId: string | undefined = (idToken['user_org'] || idToken['organization_id']) as\n | string\n | undefined;\n const scopes: string = (idToken['scope'] as string | undefined) ?? '';\n const iat: number = (idToken['iat'] as number | undefined) ?? Math.floor(Date.now() / 1000);\n const exp: number = (idToken['exp'] as number | undefined) ?? iat + 3600;\n const expiresIn: number = Math.max(exp - iat, 0);\n\n const config: ThunderIDNextConfig = await client.getConfiguration();\n const sessionCookieExpiryTime: number = SessionManager.resolveSessionCookieExpiry(\n config.sessionCookie?.expiryTime,\n );\n\n const sessionToken: string = await SessionManager.createSessionToken(\n response.assertion,\n userIdFromToken,\n sessionId,\n scopes,\n expiresIn,\n '',\n organizationId,\n );\n\n cookieStore.set(\n SessionManager.getSessionCookieName(),\n sessionToken,\n SessionManager.getSessionCookieOptions(sessionCookieExpiryTime),\n );\n\n cookieStore.delete(SessionManager.getTempSessionCookieName());\n\n const afterSignInUrl: string = await (await client.getStorageManager()).getConfigDataParameter('afterSignInUrl');\n return {data: {afterSignInUrl: String(afterSignInUrl)}, success: true};\n }\n\n return {data: response as Record<string, unknown>, success: true};\n } catch (error) {\n const message =\n error instanceof Error\n ? error.message\n : typeof (error as any)?.message === 'string'\n ? (error as any).message\n : String(error);\n logger.error(`[signInAction] Error during sign-in: ${message}`);\n return {error: message, success: false};\n }\n};\n\nexport default signInAction;\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2CA,MAAM,eAAe,OACnB,SACA,YAUI;AACJ,KAAI;EACF,MAAM,SAASA,mBAAW;EAC1B,MAAMC,cAA8B,MAAM,SAAS;EAEnD,IAAIC;EAEJ,MAAMC,uBAA2C,YAAY,IAAIC,uBAAe,sBAAsB,CAAC,EAAE;AAEzG,MAAI,qBACF,KAAI;AAEF,gBAD4C,MAAMA,uBAAe,mBAAmB,qBAAqB,EAC9E;UACrB;AAKV,MAAI,CAAC,WAAW;GACd,MAAMC,mBAAuC,YAAY,IAAID,uBAAe,0BAA0B,CAAC,EAAE;AAEzG,OAAI,iBACF,KAAI;AAEF,iBADyC,MAAMA,uBAAe,kBAAkB,iBAAiB,EACzE;WAClB;;AAMZ,MAAI,CAAC,WAAW;AACd,eAAY,mBAAmB;GAE/B,MAAME,mBAA2B,MAAMF,uBAAe,kBAAkB,UAAU;AAElF,eAAY,IACVA,uBAAe,0BAA0B,EACzC,kBACAA,uBAAe,6BAA6B,CAC7C;;AAIH,MAAI,CAAC,WAAW,QAAQ,QAAQ,EAAE;GAChC,MAAMG,mBAA2B,MAAM,OAAO,uBAAuB,EAAE,EAAE,UAAU;AACnF,UAAO;IAAC,MAAM,EAAC,WAAW,OAAO,iBAAiB,EAAC;IAAE,SAAS;IAAK;;EAIrE,MAAMC,WAAgB,MAAM,OAAO,OAAO,SAAS,SAAU,UAAU;AAEvE,MAAI,SAAS,eAAe,yBAAyB,UAAU;AAK7D,OAAI,CAAC,SAAS,UACZ,OAAM,IAAI,MAAM,sDAAsD;GAGxE,MAAMC,UAAmB,MAAM,OAAO,kBAAkB,WAAW,SAAS,UAAU;GACtF,MAAMC,kBAA2B,QAAQ,OAA8B;GACvE,MAAMC,iBAAsC,QAAQ,eAAe,QAAQ;GAG3E,MAAMC,SAAkB,QAAQ,YAAmC;GACnE,MAAMC,MAAe,QAAQ,UAAiC,KAAK,MAAM,KAAK,KAAK,GAAG,IAAK;GAC3F,MAAMC,MAAe,QAAQ,UAAiC,MAAM;GACpE,MAAMC,YAAoB,KAAK,IAAI,MAAM,KAAK,EAAE;GAEhD,MAAMC,SAA8B,MAAM,OAAO,kBAAkB;GACnE,MAAMC,0BAAkCb,uBAAe,2BACrD,OAAO,eAAe,WACvB;GAED,MAAMc,eAAuB,MAAMd,uBAAe,mBAChD,SAAS,WACT,iBACA,WACA,QACA,WACA,IACA,eACD;AAED,eAAY,IACVA,uBAAe,sBAAsB,EACrC,cACAA,uBAAe,wBAAwB,wBAAwB,CAChE;AAED,eAAY,OAAOA,uBAAe,0BAA0B,CAAC;GAE7D,MAAMe,iBAAyB,OAAO,MAAM,OAAO,mBAAmB,EAAE,uBAAuB,iBAAiB;AAChH,UAAO;IAAC,MAAM,EAAC,gBAAgB,OAAO,eAAe,EAAC;IAAE,SAAS;IAAK;;AAGxE,SAAO;GAAC,MAAM;GAAqC,SAAS;GAAK;UAC1D,OAAO;EACd,MAAM,UACJ,iBAAiB,QACb,MAAM,UACN,OAAQ,OAAe,YAAY,WAChC,MAAc,UACf,OAAO,MAAM;AACrB,iBAAO,MAAM,wCAAwC,UAAU;AAC/D,SAAO;GAAC,OAAO;GAAS,SAAS;GAAM;;;AAI3C,2BAAe"}
1
+ {"version":3,"file":"signInAction.js","names":["getClient","cookieStore: RequestCookies","sessionId: string | undefined","existingSessionToken: string | undefined","SessionManager","tempSessionToken: string | undefined","tempSessionToken: string","defaultSignInUrl: string","response: any","idToken: IdToken","userIdFromToken: string","organizationId: string | undefined","scopes: string","iat: number","exp: number","expiresIn: number","config: ThunderIDNextConfig","sessionCookieExpiryTime: number","sessionToken: string","afterSignInUrl: string"],"sources":["../../../src/server/actions/signInAction.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n'use server';\n\nimport {\n generateSessionId,\n EmbeddedSignInFlowStatus,\n EmbeddedFlowExecuteRequestConfig,\n IdToken,\n isEmpty,\n} from '@thunderid/node';\nimport {cookies} from 'next/headers';\nimport {ThunderIDNextConfig} from '../../models/config';\nimport logger from '../../utils/logger';\nimport SessionManager, {SessionTokenPayload} from '../../utils/SessionManager';\nimport getClient from '../getClient';\n\ntype RequestCookies = Awaited<ReturnType<typeof cookies>>;\n\n/**\n * Server action for signing in a user.\n * Handles the embedded sign-in flow and manages session cookies.\n *\n * @param payload - The embedded sign-in flow payload\n * @param request - The embedded flow execute request config\n * @returns Promise that resolves when sign-in is complete\n */\nconst signInAction = async (\n payload?: any,\n request?: EmbeddedFlowExecuteRequestConfig,\n): Promise<{\n data?:\n | {\n afterSignInUrl?: string;\n signInUrl?: string;\n }\n | Record<string, unknown>;\n error?: string;\n success: boolean;\n}> => {\n try {\n const client = getClient();\n const cookieStore: RequestCookies = await cookies();\n\n let sessionId: string | undefined;\n\n const existingSessionToken: string | undefined = cookieStore.get(SessionManager.getSessionCookieName())?.value;\n\n if (existingSessionToken) {\n try {\n const sessionPayload: SessionTokenPayload = await SessionManager.verifySessionToken(existingSessionToken);\n sessionId = sessionPayload.sessionId;\n } catch {\n // Invalid session token, will create new temp session\n }\n }\n\n if (!sessionId) {\n const tempSessionToken: string | undefined = cookieStore.get(SessionManager.getTempSessionCookieName())?.value;\n\n if (tempSessionToken) {\n try {\n const tempSession: {sessionId: string} = await SessionManager.verifyTempSession(tempSessionToken);\n sessionId = tempSession.sessionId;\n } catch {\n // Invalid temp session, will create new one\n }\n }\n }\n\n if (!sessionId) {\n sessionId = generateSessionId();\n\n const tempSessionToken: string = await SessionManager.createTempSession(sessionId);\n\n cookieStore.set(\n SessionManager.getTempSessionCookieName(),\n tempSessionToken,\n SessionManager.getTempSessionCookieOptions(),\n );\n }\n\n // If no payload provided, redirect to sign-in URL for redirect-based sign-in.\n if (!payload || isEmpty(payload)) {\n const defaultSignInUrl: string = await client.getAuthorizeRequestUrl({}, sessionId);\n return {data: {signInUrl: String(defaultSignInUrl)}, success: true};\n }\n\n // Handle embedded sign-in flow\n const response: any = await client.signIn(payload, request!, sessionId);\n\n if (response.flowStatus === EmbeddedSignInFlowStatus.Complete) {\n // On the V2 platform, a completed embedded flow (without a preceding `/authorize` redirect,\n // i.e. no `authId`) returns a self-contained JWT `assertion` rather than an authorization\n // code to exchange. This mirrors how @thunderid/react and @thunderid/vue treat it: the\n // assertion is used directly as the bearer session token.\n if (!response.assertion) {\n throw new Error('[signInAction] Flow completed without an assertion.');\n }\n\n const idToken: IdToken = await client.getDecodedIdToken(sessionId, response.assertion);\n const userIdFromToken: string = (idToken.sub as string | undefined) ?? sessionId;\n const organizationId: string | undefined = (idToken['user_org'] || idToken['organization_id']) as\n | string\n | undefined;\n const scopes: string = (idToken['scope'] as string | undefined) ?? '';\n const iat: number = (idToken['iat'] as number | undefined) ?? Math.floor(Date.now() / 1000);\n const exp: number = (idToken['exp'] as number | undefined) ?? iat + 3600;\n const expiresIn: number = Math.max(exp - iat, 0);\n\n const config: ThunderIDNextConfig = await client.getConfiguration();\n const sessionCookieExpiryTime: number = SessionManager.resolveSessionCookieExpiry(\n config.sessionCookie?.expiryTime,\n );\n\n const sessionToken: string = await SessionManager.createSessionToken(\n response.assertion,\n userIdFromToken,\n sessionId,\n scopes,\n expiresIn,\n '',\n organizationId,\n );\n\n cookieStore.set(\n SessionManager.getSessionCookieName(),\n sessionToken,\n SessionManager.getSessionCookieOptions(sessionCookieExpiryTime),\n );\n\n cookieStore.delete(SessionManager.getTempSessionCookieName());\n\n const afterSignInUrl: string = await (await client.getStorageManager()).getConfigDataParameter('afterSignInUrl');\n return {data: {afterSignInUrl: String(afterSignInUrl)}, success: true};\n }\n\n return {data: response as Record<string, unknown>, success: true};\n } catch (error) {\n const message =\n error instanceof Error\n ? error.message\n : typeof (error as any)?.message === 'string'\n ? (error as any).message\n : String(error);\n logger.error(`[signInAction] Error during sign-in: ${message}`);\n return {error: message, success: false};\n }\n};\n\nexport default signInAction;\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,MAAM,eAAe,OACnB,SACA,YAUI;AACJ,KAAI;EACF,MAAM,SAASA,mBAAW;EAC1B,MAAMC,cAA8B,MAAM,SAAS;EAEnD,IAAIC;EAEJ,MAAMC,uBAA2C,YAAY,IAAIC,uBAAe,sBAAsB,CAAC,EAAE;AAEzG,MAAI,qBACF,KAAI;AAEF,gBAD4C,MAAMA,uBAAe,mBAAmB,qBAAqB,EAC9E;UACrB;AAKV,MAAI,CAAC,WAAW;GACd,MAAMC,mBAAuC,YAAY,IAAID,uBAAe,0BAA0B,CAAC,EAAE;AAEzG,OAAI,iBACF,KAAI;AAEF,iBADyC,MAAMA,uBAAe,kBAAkB,iBAAiB,EACzE;WAClB;;AAMZ,MAAI,CAAC,WAAW;AACd,eAAY,mBAAmB;GAE/B,MAAME,mBAA2B,MAAMF,uBAAe,kBAAkB,UAAU;AAElF,eAAY,IACVA,uBAAe,0BAA0B,EACzC,kBACAA,uBAAe,6BAA6B,CAC7C;;AAIH,MAAI,CAAC,WAAW,QAAQ,QAAQ,EAAE;GAChC,MAAMG,mBAA2B,MAAM,OAAO,uBAAuB,EAAE,EAAE,UAAU;AACnF,UAAO;IAAC,MAAM,EAAC,WAAW,OAAO,iBAAiB,EAAC;IAAE,SAAS;IAAK;;EAIrE,MAAMC,WAAgB,MAAM,OAAO,OAAO,SAAS,SAAU,UAAU;AAEvE,MAAI,SAAS,eAAe,yBAAyB,UAAU;AAK7D,OAAI,CAAC,SAAS,UACZ,OAAM,IAAI,MAAM,sDAAsD;GAGxE,MAAMC,UAAmB,MAAM,OAAO,kBAAkB,WAAW,SAAS,UAAU;GACtF,MAAMC,kBAA2B,QAAQ,OAA8B;GACvE,MAAMC,iBAAsC,QAAQ,eAAe,QAAQ;GAG3E,MAAMC,SAAkB,QAAQ,YAAmC;GACnE,MAAMC,MAAe,QAAQ,UAAiC,KAAK,MAAM,KAAK,KAAK,GAAG,IAAK;GAC3F,MAAMC,MAAe,QAAQ,UAAiC,MAAM;GACpE,MAAMC,YAAoB,KAAK,IAAI,MAAM,KAAK,EAAE;GAEhD,MAAMC,SAA8B,MAAM,OAAO,kBAAkB;GACnE,MAAMC,0BAAkCb,uBAAe,2BACrD,OAAO,eAAe,WACvB;GAED,MAAMc,eAAuB,MAAMd,uBAAe,mBAChD,SAAS,WACT,iBACA,WACA,QACA,WACA,IACA,eACD;AAED,eAAY,IACVA,uBAAe,sBAAsB,EACrC,cACAA,uBAAe,wBAAwB,wBAAwB,CAChE;AAED,eAAY,OAAOA,uBAAe,0BAA0B,CAAC;GAE7D,MAAMe,iBAAyB,OAAO,MAAM,OAAO,mBAAmB,EAAE,uBAAuB,iBAAiB;AAChH,UAAO;IAAC,MAAM,EAAC,gBAAgB,OAAO,eAAe,EAAC;IAAE,SAAS;IAAK;;AAGxE,SAAO;GAAC,MAAM;GAAqC,SAAS;GAAK;UAC1D,OAAO;EACd,MAAM,UACJ,iBAAiB,QACb,MAAM,UACN,OAAQ,OAAe,YAAY,WAChC,MAAc,UACf,OAAO,MAAM;AACrB,iBAAO,MAAM,wCAAwC,UAAU;AAC/D,SAAO;GAAC,OAAO;GAAS,SAAS;GAAM;;;AAI3C,2BAAe"}
@@ -1,20 +1,3 @@
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
1
  /**
19
2
  * Server action for signing out a user.
20
3
  * Clears both JWT and legacy session cookies.
@@ -1 +1 @@
1
- {"version":3,"file":"signOutAction.d.ts","sourceRoot":"","sources":["../../../src/server/actions/signOutAction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAYH;;;;;GAKG;AACH,QAAA,MAAM,aAAa,QAAa,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE;QAAC,eAAe,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAC,CA8C7G,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"signOutAction.d.ts","sourceRoot":"","sources":["../../../src/server/actions/signOutAction.ts"],"names":[],"mappings":"AAaA;;;;;GAKG;AACH,QAAA,MAAM,aAAa,QAAa,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE;QAAC,eAAe,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAC,CA8C7G,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"signOutAction.js","names":["cookieStore: RequestCookies","SessionManager","getClient","sessionId: string | undefined","getSessionId","errorMessage: unknown"],"sources":["../../../src/server/actions/signOutAction.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n'use server';\n\nimport {cookies} from 'next/headers';\nimport getSessionId from './getSessionId';\nimport logger from '../../utils/logger';\nimport SessionManager from '../../utils/SessionManager';\nimport getClient from '../getClient';\n\ntype RequestCookies = Awaited<ReturnType<typeof cookies>>;\n\n/**\n * Server action for signing out a user.\n * Clears both JWT and legacy session cookies.\n *\n * @returns Promise that resolves with success status and optional after sign-out URL\n */\nconst signOutAction = async (): Promise<{data?: {afterSignOutUrl?: string}; error?: unknown; success: boolean}> => {\n logger.debug('[signOutAction] Initiating sign out process from the server action.');\n\n const clearSessionCookies = async (): Promise<void> => {\n const cookieStore: RequestCookies = await cookies();\n\n cookieStore.delete(SessionManager.getSessionCookieName());\n cookieStore.delete(SessionManager.getTempSessionCookieName());\n };\n\n try {\n const client = getClient();\n const sessionId: string | undefined = await getSessionId();\n\n let afterSignOutUrl = '/';\n\n if (sessionId) {\n logger.debug('[signOutAction] Session ID found, invoking the `signOut` to obtain the `afterSignOutUrl`.');\n\n afterSignOutUrl = await client.signOut({}, sessionId);\n }\n\n await clearSessionCookies();\n\n return {data: {afterSignOutUrl}, success: true};\n } catch (error) {\n logger.error('[signOutAction] Error during sign out from the server action:', error);\n\n logger.debug('[signOutAction] Clearing session cookies due to error as a fallback.');\n\n await clearSessionCookies();\n\n let errorMessage: unknown;\n if (typeof error === 'string') {\n errorMessage = error;\n } else if (error instanceof Error) {\n errorMessage = error.message;\n } else {\n errorMessage = JSON.stringify(error);\n }\n\n return {\n error: errorMessage,\n success: false,\n };\n }\n};\n\nexport default signOutAction;\n"],"mappings":";;;;;;;;;;;;;;;;AAkCA,MAAM,gBAAgB,YAA6F;AACjH,gBAAO,MAAM,sEAAsE;CAEnF,MAAM,sBAAsB,YAA2B;EACrD,MAAMA,cAA8B,MAAM,SAAS;AAEnD,cAAY,OAAOC,uBAAe,sBAAsB,CAAC;AACzD,cAAY,OAAOA,uBAAe,0BAA0B,CAAC;;AAG/D,KAAI;EACF,MAAM,SAASC,mBAAW;EAC1B,MAAMC,YAAgC,MAAMC,sBAAc;EAE1D,IAAI,kBAAkB;AAEtB,MAAI,WAAW;AACb,kBAAO,MAAM,4FAA4F;AAEzG,qBAAkB,MAAM,OAAO,QAAQ,EAAE,EAAE,UAAU;;AAGvD,QAAM,qBAAqB;AAE3B,SAAO;GAAC,MAAM,EAAC,iBAAgB;GAAE,SAAS;GAAK;UACxC,OAAO;AACd,iBAAO,MAAM,iEAAiE,MAAM;AAEpF,iBAAO,MAAM,uEAAuE;AAEpF,QAAM,qBAAqB;EAE3B,IAAIC;AACJ,MAAI,OAAO,UAAU,SACnB,gBAAe;WACN,iBAAiB,MAC1B,gBAAe,MAAM;MAErB,gBAAe,KAAK,UAAU,MAAM;AAGtC,SAAO;GACL,OAAO;GACP,SAAS;GACV;;;AAIL,4BAAe"}
1
+ {"version":3,"file":"signOutAction.js","names":["cookieStore: RequestCookies","SessionManager","getClient","sessionId: string | undefined","getSessionId","errorMessage: unknown"],"sources":["../../../src/server/actions/signOutAction.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n'use server';\n\nimport {cookies} from 'next/headers';\nimport getSessionId from './getSessionId';\nimport logger from '../../utils/logger';\nimport SessionManager from '../../utils/SessionManager';\nimport getClient from '../getClient';\n\ntype RequestCookies = Awaited<ReturnType<typeof cookies>>;\n\n/**\n * Server action for signing out a user.\n * Clears both JWT and legacy session cookies.\n *\n * @returns Promise that resolves with success status and optional after sign-out URL\n */\nconst signOutAction = async (): Promise<{data?: {afterSignOutUrl?: string}; error?: unknown; success: boolean}> => {\n logger.debug('[signOutAction] Initiating sign out process from the server action.');\n\n const clearSessionCookies = async (): Promise<void> => {\n const cookieStore: RequestCookies = await cookies();\n\n cookieStore.delete(SessionManager.getSessionCookieName());\n cookieStore.delete(SessionManager.getTempSessionCookieName());\n };\n\n try {\n const client = getClient();\n const sessionId: string | undefined = await getSessionId();\n\n let afterSignOutUrl = '/';\n\n if (sessionId) {\n logger.debug('[signOutAction] Session ID found, invoking the `signOut` to obtain the `afterSignOutUrl`.');\n\n afterSignOutUrl = await client.signOut({}, sessionId);\n }\n\n await clearSessionCookies();\n\n return {data: {afterSignOutUrl}, success: true};\n } catch (error) {\n logger.error('[signOutAction] Error during sign out from the server action:', error);\n\n logger.debug('[signOutAction] Clearing session cookies due to error as a fallback.');\n\n await clearSessionCookies();\n\n let errorMessage: unknown;\n if (typeof error === 'string') {\n errorMessage = error;\n } else if (error instanceof Error) {\n errorMessage = error.message;\n } else {\n errorMessage = JSON.stringify(error);\n }\n\n return {\n error: errorMessage,\n success: false,\n };\n }\n};\n\nexport default signOutAction;\n"],"mappings":";;;;;;;;;;;;;;;;AAmBA,MAAM,gBAAgB,YAA6F;AACjH,gBAAO,MAAM,sEAAsE;CAEnF,MAAM,sBAAsB,YAA2B;EACrD,MAAMA,cAA8B,MAAM,SAAS;AAEnD,cAAY,OAAOC,uBAAe,sBAAsB,CAAC;AACzD,cAAY,OAAOA,uBAAe,0BAA0B,CAAC;;AAG/D,KAAI;EACF,MAAM,SAASC,mBAAW;EAC1B,MAAMC,YAAgC,MAAMC,sBAAc;EAE1D,IAAI,kBAAkB;AAEtB,MAAI,WAAW;AACb,kBAAO,MAAM,4FAA4F;AAEzG,qBAAkB,MAAM,OAAO,QAAQ,EAAE,EAAE,UAAU;;AAGvD,QAAM,qBAAqB;AAE3B,SAAO;GAAC,MAAM,EAAC,iBAAgB;GAAE,SAAS;GAAK;UACxC,OAAO;AACd,iBAAO,MAAM,iEAAiE,MAAM;AAEpF,iBAAO,MAAM,uEAAuE;AAEpF,QAAM,qBAAqB;EAE3B,IAAIC;AACJ,MAAI,OAAO,UAAU,SACnB,gBAAe;WACN,iBAAiB,MAC1B,gBAAe,MAAM;MAErB,gBAAe,KAAK,UAAU,MAAM;AAGtC,SAAO;GACL,OAAO;GACP,SAAS;GACV;;;AAIL,4BAAe"}
@@ -1,20 +1,3 @@
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
1
  /**
19
2
  * Server action for initiating the sign-up redirect flow.
20
3
  */
@@ -1 +1 @@
1
- {"version":3,"file":"signUpAction.d.ts","sourceRoot":"","sources":["../../../src/server/actions/signUpAction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH;;GAEG;AACH,QAAA,MAAM,YAAY,QAAa,OAAO,CAAC;IACrC,IAAI,CAAC,EAAE;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB,CAUA,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"signUpAction.d.ts","sourceRoot":"","sources":["../../../src/server/actions/signUpAction.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,QAAA,MAAM,YAAY,QAAa,OAAO,CAAC;IACrC,IAAI,CAAC,EAAE;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB,CAUA,CAAC;AAEF,eAAe,YAAY,CAAC"}