@civic/auth 0.1.2 → 0.1.4-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +329 -116
- package/dist/cjs/browser/storage.d.ts +3 -0
- package/dist/cjs/browser/storage.d.ts.map +1 -1
- package/dist/cjs/browser/storage.js +8 -0
- package/dist/cjs/browser/storage.js.map +1 -1
- package/dist/cjs/lib/cookies.d.ts +2 -2
- package/dist/cjs/lib/cookies.d.ts.map +1 -1
- package/dist/cjs/lib/cookies.js +7 -5
- package/dist/cjs/lib/cookies.js.map +1 -1
- package/dist/cjs/lib/postMessage.js +1 -1
- package/dist/cjs/lib/postMessage.js.map +1 -1
- package/dist/cjs/lib/windowUtil.d.ts.map +1 -1
- package/dist/cjs/lib/windowUtil.js +1 -0
- package/dist/cjs/lib/windowUtil.js.map +1 -1
- package/dist/cjs/nextjs/config.d.ts.map +1 -1
- package/dist/cjs/nextjs/config.js +12 -0
- package/dist/cjs/nextjs/config.js.map +1 -1
- package/dist/cjs/nextjs/hooks/index.d.ts +1 -1
- package/dist/cjs/nextjs/hooks/index.d.ts.map +1 -1
- package/dist/cjs/nextjs/hooks/index.js +3 -3
- package/dist/cjs/nextjs/hooks/index.js.map +1 -1
- package/dist/cjs/nextjs/hooks/useUserCookie.d.ts.map +1 -1
- package/dist/cjs/nextjs/hooks/useUserCookie.js +43 -14
- package/dist/cjs/nextjs/hooks/useUserCookie.js.map +1 -1
- package/dist/cjs/nextjs/providers/NextAuthProvider.d.ts +5 -1
- package/dist/cjs/nextjs/providers/NextAuthProvider.d.ts.map +1 -1
- package/dist/cjs/nextjs/providers/NextAuthProvider.js +74 -35
- package/dist/cjs/nextjs/providers/NextAuthProvider.js.map +1 -1
- package/dist/cjs/reactjs/components/UserButton.js +20 -10
- package/dist/cjs/reactjs/components/UserButton.js.map +1 -1
- package/dist/cjs/reactjs/hooks/index.d.ts +0 -1
- package/dist/cjs/reactjs/hooks/index.d.ts.map +1 -1
- package/dist/cjs/reactjs/hooks/index.js +1 -3
- package/dist/cjs/reactjs/hooks/index.js.map +1 -1
- package/dist/cjs/services/AuthenticationService.d.ts +4 -1
- package/dist/cjs/services/AuthenticationService.d.ts.map +1 -1
- package/dist/cjs/services/AuthenticationService.js +38 -7
- package/dist/cjs/services/AuthenticationService.js.map +1 -1
- package/dist/cjs/shared/components/BlockDisplay.d.ts +7 -0
- package/dist/cjs/shared/components/BlockDisplay.d.ts.map +1 -0
- package/dist/cjs/shared/components/BlockDisplay.js +31 -0
- package/dist/cjs/shared/components/BlockDisplay.js.map +1 -0
- package/dist/cjs/shared/components/CivicAuthIframe.js +17 -7
- package/dist/cjs/shared/components/CivicAuthIframe.js.map +1 -1
- package/dist/cjs/shared/components/CivicAuthIframeContainer.d.ts.map +1 -1
- package/dist/cjs/shared/components/CivicAuthIframeContainer.js +39 -20
- package/dist/cjs/shared/components/CivicAuthIframeContainer.js.map +1 -1
- package/dist/cjs/shared/components/IFrameAndLoading.d.ts +7 -0
- package/dist/cjs/shared/components/IFrameAndLoading.d.ts.map +1 -0
- package/dist/cjs/shared/components/IFrameAndLoading.js +28 -0
- package/dist/cjs/shared/components/IFrameAndLoading.js.map +1 -0
- package/dist/cjs/shared/hooks/index.d.ts +5 -1
- package/dist/cjs/shared/hooks/index.d.ts.map +1 -1
- package/dist/cjs/shared/hooks/index.js +11 -3
- package/dist/cjs/shared/hooks/index.js.map +1 -1
- package/dist/cjs/shared/hooks/useCivicAuthConfig.d.ts +3 -0
- package/dist/cjs/shared/hooks/useCivicAuthConfig.d.ts.map +1 -0
- package/dist/cjs/shared/hooks/useCivicAuthConfig.js +13 -0
- package/dist/cjs/shared/hooks/useCivicAuthConfig.js.map +1 -0
- package/dist/cjs/shared/hooks/useClientTokenExchangeSession.d.ts +3 -0
- package/dist/cjs/shared/hooks/useClientTokenExchangeSession.d.ts.map +1 -0
- package/dist/cjs/shared/hooks/useClientTokenExchangeSession.js +16 -0
- package/dist/cjs/shared/hooks/useClientTokenExchangeSession.js.map +1 -0
- package/dist/cjs/shared/hooks/useCurrentUrl.d.ts +3 -0
- package/dist/cjs/shared/hooks/useCurrentUrl.d.ts.map +1 -0
- package/dist/cjs/shared/hooks/useCurrentUrl.js +27 -0
- package/dist/cjs/shared/hooks/useCurrentUrl.js.map +1 -0
- package/dist/cjs/shared/hooks/useIsInIframe.d.ts +3 -0
- package/dist/cjs/shared/hooks/useIsInIframe.d.ts.map +1 -0
- package/dist/cjs/shared/hooks/useIsInIframe.js +17 -0
- package/dist/cjs/shared/hooks/useIsInIframe.js.map +1 -0
- package/dist/cjs/shared/hooks/useOAuthEndpoints.d.ts +4 -0
- package/dist/cjs/shared/hooks/useOAuthEndpoints.d.ts.map +1 -0
- package/dist/cjs/shared/hooks/useOAuthEndpoints.js +17 -0
- package/dist/cjs/shared/hooks/useOAuthEndpoints.js.map +1 -0
- package/dist/cjs/shared/hooks/useRefresh.d.ts +4 -0
- package/dist/cjs/shared/hooks/useRefresh.d.ts.map +1 -0
- package/dist/cjs/shared/hooks/useRefresh.js +41 -0
- package/dist/cjs/shared/hooks/useRefresh.js.map +1 -0
- package/dist/cjs/shared/hooks/useSession.d.ts +1 -1
- package/dist/cjs/shared/hooks/useSession.d.ts.map +1 -1
- package/dist/cjs/shared/hooks/useSignIn.d.ts +14 -0
- package/dist/cjs/shared/hooks/useSignIn.d.ts.map +1 -0
- package/dist/cjs/shared/hooks/useSignIn.js +74 -0
- package/dist/cjs/shared/hooks/useSignIn.js.map +1 -0
- package/dist/cjs/shared/lib/GenericAuthenticationRefresher.d.ts +4 -0
- package/dist/cjs/shared/lib/GenericAuthenticationRefresher.d.ts.map +1 -1
- package/dist/cjs/shared/lib/GenericAuthenticationRefresher.js +30 -0
- package/dist/cjs/shared/lib/GenericAuthenticationRefresher.js.map +1 -1
- package/dist/cjs/shared/lib/types.d.ts +14 -1
- package/dist/cjs/shared/lib/types.d.ts.map +1 -1
- package/dist/cjs/shared/lib/types.js +2 -0
- package/dist/cjs/shared/lib/types.js.map +1 -1
- package/dist/cjs/shared/lib/util.d.ts.map +1 -1
- package/dist/cjs/shared/lib/util.js +27 -9
- package/dist/cjs/shared/lib/util.js.map +1 -1
- package/dist/cjs/shared/providers/AuthProvider.d.ts +3 -2
- package/dist/cjs/shared/providers/AuthProvider.d.ts.map +1 -1
- package/dist/cjs/shared/providers/AuthProvider.js +53 -244
- package/dist/cjs/shared/providers/AuthProvider.js.map +1 -1
- package/dist/cjs/shared/providers/CivicAuthConfigContext.d.ts +16 -0
- package/dist/cjs/shared/providers/CivicAuthConfigContext.d.ts.map +1 -0
- package/dist/cjs/shared/providers/CivicAuthConfigContext.js +80 -0
- package/dist/cjs/shared/providers/CivicAuthConfigContext.js.map +1 -0
- package/dist/cjs/shared/providers/CivicAuthProvider.d.ts.map +1 -1
- package/dist/cjs/shared/providers/CivicAuthProvider.js +23 -6
- package/dist/cjs/shared/providers/CivicAuthProvider.js.map +1 -1
- package/dist/cjs/shared/providers/ClientTokenExchangeSessionProvider.d.ts +17 -0
- package/dist/cjs/shared/providers/ClientTokenExchangeSessionProvider.d.ts.map +1 -0
- package/dist/cjs/shared/providers/ClientTokenExchangeSessionProvider.js +183 -0
- package/dist/cjs/shared/providers/ClientTokenExchangeSessionProvider.js.map +1 -0
- package/dist/cjs/shared/providers/IframeProvider.d.ts +7 -4
- package/dist/cjs/shared/providers/IframeProvider.d.ts.map +1 -1
- package/dist/cjs/shared/providers/IframeProvider.js +37 -9
- package/dist/cjs/shared/providers/IframeProvider.js.map +1 -1
- package/dist/cjs/shared/providers/SessionProvider.d.ts +10 -4
- package/dist/cjs/shared/providers/SessionProvider.d.ts.map +1 -1
- package/dist/cjs/shared/providers/SessionProvider.js +32 -12
- package/dist/cjs/shared/providers/SessionProvider.js.map +1 -1
- package/dist/cjs/shared/providers/TokenProvider.d.ts.map +1 -1
- package/dist/cjs/shared/providers/TokenProvider.js +29 -30
- package/dist/cjs/shared/providers/TokenProvider.js.map +1 -1
- package/dist/cjs/shared/providers/UserProvider.d.ts +4 -3
- package/dist/cjs/shared/providers/UserProvider.d.ts.map +1 -1
- package/dist/cjs/shared/providers/UserProvider.js +46 -25
- package/dist/cjs/shared/providers/UserProvider.js.map +1 -1
- package/dist/cjs/types.d.ts +1 -0
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/utils.d.ts.map +1 -1
- package/dist/esm/browser/storage.d.ts +3 -0
- package/dist/esm/browser/storage.d.ts.map +1 -1
- package/dist/esm/browser/storage.js +8 -0
- package/dist/esm/browser/storage.js.map +1 -1
- package/dist/esm/lib/cookies.d.ts +2 -2
- package/dist/esm/lib/cookies.d.ts.map +1 -1
- package/dist/esm/lib/cookies.js +7 -5
- package/dist/esm/lib/cookies.js.map +1 -1
- package/dist/esm/lib/postMessage.js +1 -1
- package/dist/esm/lib/postMessage.js.map +1 -1
- package/dist/esm/lib/windowUtil.d.ts.map +1 -1
- package/dist/esm/lib/windowUtil.js +1 -0
- package/dist/esm/lib/windowUtil.js.map +1 -1
- package/dist/esm/nextjs/config.d.ts.map +1 -1
- package/dist/esm/nextjs/config.js +12 -0
- package/dist/esm/nextjs/config.js.map +1 -1
- package/dist/esm/nextjs/hooks/index.d.ts +1 -1
- package/dist/esm/nextjs/hooks/index.d.ts.map +1 -1
- package/dist/esm/nextjs/hooks/index.js +1 -1
- package/dist/esm/nextjs/hooks/index.js.map +1 -1
- package/dist/esm/nextjs/hooks/useUserCookie.d.ts.map +1 -1
- package/dist/esm/nextjs/hooks/useUserCookie.js +45 -16
- package/dist/esm/nextjs/hooks/useUserCookie.js.map +1 -1
- package/dist/esm/nextjs/providers/NextAuthProvider.d.ts +5 -1
- package/dist/esm/nextjs/providers/NextAuthProvider.d.ts.map +1 -1
- package/dist/esm/nextjs/providers/NextAuthProvider.js +59 -30
- package/dist/esm/nextjs/providers/NextAuthProvider.js.map +1 -1
- package/dist/esm/reactjs/components/UserButton.js +3 -3
- package/dist/esm/reactjs/components/UserButton.js.map +1 -1
- package/dist/esm/reactjs/hooks/index.d.ts +0 -1
- package/dist/esm/reactjs/hooks/index.d.ts.map +1 -1
- package/dist/esm/reactjs/hooks/index.js +0 -1
- package/dist/esm/reactjs/hooks/index.js.map +1 -1
- package/dist/esm/services/AuthenticationService.d.ts +4 -1
- package/dist/esm/services/AuthenticationService.d.ts.map +1 -1
- package/dist/esm/services/AuthenticationService.js +39 -8
- package/dist/esm/services/AuthenticationService.js.map +1 -1
- package/dist/esm/shared/components/BlockDisplay.d.ts +7 -0
- package/dist/esm/shared/components/BlockDisplay.d.ts.map +1 -0
- package/dist/esm/shared/components/BlockDisplay.js +25 -0
- package/dist/esm/shared/components/BlockDisplay.js.map +1 -0
- package/dist/esm/shared/components/CivicAuthIframeContainer.d.ts.map +1 -1
- package/dist/esm/shared/components/CivicAuthIframeContainer.js +23 -14
- package/dist/esm/shared/components/CivicAuthIframeContainer.js.map +1 -1
- package/dist/esm/shared/components/IFrameAndLoading.d.ts +7 -0
- package/dist/esm/shared/components/IFrameAndLoading.d.ts.map +1 -0
- package/dist/esm/shared/components/IFrameAndLoading.js +22 -0
- package/dist/esm/shared/components/IFrameAndLoading.js.map +1 -0
- package/dist/esm/shared/hooks/index.d.ts +5 -1
- package/dist/esm/shared/hooks/index.d.ts.map +1 -1
- package/dist/esm/shared/hooks/index.js +5 -1
- package/dist/esm/shared/hooks/index.js.map +1 -1
- package/dist/esm/shared/hooks/useCivicAuthConfig.d.ts +3 -0
- package/dist/esm/shared/hooks/useCivicAuthConfig.d.ts.map +1 -0
- package/dist/esm/shared/hooks/useCivicAuthConfig.js +10 -0
- package/dist/esm/shared/hooks/useCivicAuthConfig.js.map +1 -0
- package/dist/esm/shared/hooks/useClientTokenExchangeSession.d.ts +3 -0
- package/dist/esm/shared/hooks/useClientTokenExchangeSession.d.ts.map +1 -0
- package/dist/esm/shared/hooks/useClientTokenExchangeSession.js +13 -0
- package/dist/esm/shared/hooks/useClientTokenExchangeSession.js.map +1 -0
- package/dist/esm/shared/hooks/useCurrentUrl.d.ts +3 -0
- package/dist/esm/shared/hooks/useCurrentUrl.d.ts.map +1 -0
- package/dist/esm/shared/hooks/useCurrentUrl.js +24 -0
- package/dist/esm/shared/hooks/useCurrentUrl.js.map +1 -0
- package/dist/esm/shared/hooks/useIsInIframe.d.ts +3 -0
- package/dist/esm/shared/hooks/useIsInIframe.d.ts.map +1 -0
- package/dist/esm/shared/hooks/useIsInIframe.js +14 -0
- package/dist/esm/shared/hooks/useIsInIframe.js.map +1 -0
- package/dist/esm/shared/hooks/useOAuthEndpoints.d.ts +4 -0
- package/dist/esm/shared/hooks/useOAuthEndpoints.d.ts.map +1 -0
- package/dist/esm/shared/hooks/useOAuthEndpoints.js +14 -0
- package/dist/esm/shared/hooks/useOAuthEndpoints.js.map +1 -0
- package/dist/esm/shared/hooks/useRefresh.d.ts +4 -0
- package/dist/esm/shared/hooks/useRefresh.d.ts.map +1 -0
- package/dist/esm/shared/hooks/useRefresh.js +38 -0
- package/dist/esm/shared/hooks/useRefresh.js.map +1 -0
- package/dist/esm/shared/hooks/useSession.d.ts +1 -1
- package/dist/esm/shared/hooks/useSession.d.ts.map +1 -1
- package/dist/esm/shared/hooks/useSignIn.d.ts +14 -0
- package/dist/esm/shared/hooks/useSignIn.d.ts.map +1 -0
- package/dist/esm/shared/hooks/useSignIn.js +71 -0
- package/dist/esm/shared/hooks/useSignIn.js.map +1 -0
- package/dist/esm/shared/lib/GenericAuthenticationRefresher.d.ts +4 -0
- package/dist/esm/shared/lib/GenericAuthenticationRefresher.d.ts.map +1 -1
- package/dist/esm/shared/lib/GenericAuthenticationRefresher.js +30 -0
- package/dist/esm/shared/lib/GenericAuthenticationRefresher.js.map +1 -1
- package/dist/esm/shared/lib/types.d.ts +14 -1
- package/dist/esm/shared/lib/types.d.ts.map +1 -1
- package/dist/esm/shared/lib/types.js +2 -0
- package/dist/esm/shared/lib/types.js.map +1 -1
- package/dist/esm/shared/lib/util.d.ts.map +1 -1
- package/dist/esm/shared/lib/util.js +10 -2
- package/dist/esm/shared/lib/util.js.map +1 -1
- package/dist/esm/shared/providers/AuthProvider.d.ts +3 -2
- package/dist/esm/shared/providers/AuthProvider.d.ts.map +1 -1
- package/dist/esm/shared/providers/AuthProvider.js +37 -238
- package/dist/esm/shared/providers/AuthProvider.js.map +1 -1
- package/dist/esm/shared/providers/CivicAuthConfigContext.d.ts +16 -0
- package/dist/esm/shared/providers/CivicAuthConfigContext.d.ts.map +1 -0
- package/dist/esm/shared/providers/CivicAuthConfigContext.js +43 -0
- package/dist/esm/shared/providers/CivicAuthConfigContext.js.map +1 -0
- package/dist/esm/shared/providers/CivicAuthProvider.d.ts.map +1 -1
- package/dist/esm/shared/providers/CivicAuthProvider.js +23 -6
- package/dist/esm/shared/providers/CivicAuthProvider.js.map +1 -1
- package/dist/esm/shared/providers/ClientTokenExchangeSessionProvider.d.ts +17 -0
- package/dist/esm/shared/providers/ClientTokenExchangeSessionProvider.d.ts.map +1 -0
- package/dist/esm/shared/providers/ClientTokenExchangeSessionProvider.js +146 -0
- package/dist/esm/shared/providers/ClientTokenExchangeSessionProvider.js.map +1 -0
- package/dist/esm/shared/providers/IframeProvider.d.ts +7 -4
- package/dist/esm/shared/providers/IframeProvider.d.ts.map +1 -1
- package/dist/esm/shared/providers/IframeProvider.js +21 -3
- package/dist/esm/shared/providers/IframeProvider.js.map +1 -1
- package/dist/esm/shared/providers/SessionProvider.d.ts +10 -4
- package/dist/esm/shared/providers/SessionProvider.d.ts.map +1 -1
- package/dist/esm/shared/providers/SessionProvider.js +15 -5
- package/dist/esm/shared/providers/SessionProvider.js.map +1 -1
- package/dist/esm/shared/providers/TokenProvider.d.ts.map +1 -1
- package/dist/esm/shared/providers/TokenProvider.js +13 -24
- package/dist/esm/shared/providers/TokenProvider.js.map +1 -1
- package/dist/esm/shared/providers/UserProvider.d.ts +4 -3
- package/dist/esm/shared/providers/UserProvider.d.ts.map +1 -1
- package/dist/esm/shared/providers/UserProvider.js +30 -19
- package/dist/esm/shared/providers/UserProvider.js.map +1 -1
- package/dist/esm/types.d.ts +1 -0
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils.d.ts.map +1 -1
- package/dist/src/nextjs/hooks/useUserCookie.d.ts.map +1 -1
- package/dist/src/nextjs/hooks/useUserCookie.js +45 -16
- package/dist/src/nextjs/hooks/useUserCookie.js.map +1 -1
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -3
- package/.eslintignore +0 -3
- package/.eslintrc.json +0 -10
- package/.prettierignore +0 -3
- package/.prettierrc +0 -1
- package/.turbo/turbo-build.log +0 -13
- package/.turbo/turbo-lint$colon$fix.log +0 -10
- package/.turbo/turbo-test.log +0 -1153
- package/dist/cjs/nextjs/hooks/useTokenCookie.d.ts +0 -3
- package/dist/cjs/nextjs/hooks/useTokenCookie.d.ts.map +0 -1
- package/dist/cjs/nextjs/hooks/useTokenCookie.js +0 -41
- package/dist/cjs/nextjs/hooks/useTokenCookie.js.map +0 -1
- package/dist/cjs/shared/hooks/useConfig.d.ts +0 -3
- package/dist/cjs/shared/hooks/useConfig.d.ts.map +0 -1
- package/dist/cjs/shared/hooks/useConfig.js +0 -16
- package/dist/cjs/shared/hooks/useConfig.js.map +0 -1
- package/dist/cjs/shared/providers/ConfigProvider.d.ts +0 -21
- package/dist/cjs/shared/providers/ConfigProvider.d.ts.map +0 -1
- package/dist/cjs/shared/providers/ConfigProvider.js +0 -46
- package/dist/cjs/shared/providers/ConfigProvider.js.map +0 -1
- package/dist/esm/nextjs/hooks/useTokenCookie.d.ts +0 -3
- package/dist/esm/nextjs/hooks/useTokenCookie.d.ts.map +0 -1
- package/dist/esm/nextjs/hooks/useTokenCookie.js +0 -37
- package/dist/esm/nextjs/hooks/useTokenCookie.js.map +0 -1
- package/dist/esm/shared/hooks/useConfig.d.ts +0 -3
- package/dist/esm/shared/hooks/useConfig.d.ts.map +0 -1
- package/dist/esm/shared/hooks/useConfig.js +0 -13
- package/dist/esm/shared/hooks/useConfig.js.map +0 -1
- package/dist/esm/shared/providers/ConfigProvider.d.ts +0 -21
- package/dist/esm/shared/providers/ConfigProvider.d.ts.map +0 -1
- package/dist/esm/shared/providers/ConfigProvider.js +0 -19
- package/dist/esm/shared/providers/ConfigProvider.js.map +0 -1
- package/dist/src/browser/storage.d.ts +0 -6
- package/dist/src/browser/storage.d.ts.map +0 -1
- package/dist/src/browser/storage.js +0 -9
- package/dist/src/browser/storage.js.map +0 -1
- package/dist/src/config.d.ts +0 -3
- package/dist/src/config.d.ts.map +0 -1
- package/dist/src/config.js +0 -5
- package/dist/src/config.js.map +0 -1
- package/dist/src/constants.d.ts +0 -9
- package/dist/src/constants.d.ts.map +0 -1
- package/dist/src/constants.js +0 -17
- package/dist/src/constants.js.map +0 -1
- package/dist/src/index.d.ts +0 -4
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -2
- package/dist/src/index.js.map +0 -1
- package/dist/src/lib/cookies.d.ts +0 -7
- package/dist/src/lib/cookies.d.ts.map +0 -1
- package/dist/src/lib/cookies.js +0 -23
- package/dist/src/lib/cookies.js.map +0 -1
- package/dist/src/lib/jwt.d.ts +0 -3
- package/dist/src/lib/jwt.d.ts.map +0 -1
- package/dist/src/lib/jwt.js +0 -9
- package/dist/src/lib/jwt.js.map +0 -1
- package/dist/src/lib/logger.d.ts +0 -26
- package/dist/src/lib/logger.d.ts.map +0 -1
- package/dist/src/lib/logger.js +0 -55
- package/dist/src/lib/logger.js.map +0 -1
- package/dist/src/lib/oauth.d.ts +0 -19
- package/dist/src/lib/oauth.d.ts.map +0 -1
- package/dist/src/lib/oauth.js +0 -60
- package/dist/src/lib/oauth.js.map +0 -1
- package/dist/src/lib/postMessage.d.ts +0 -4
- package/dist/src/lib/postMessage.d.ts.map +0 -1
- package/dist/src/lib/postMessage.js +0 -15
- package/dist/src/lib/postMessage.js.map +0 -1
- package/dist/src/lib/windowUtil.d.ts +0 -4
- package/dist/src/lib/windowUtil.d.ts.map +0 -1
- package/dist/src/lib/windowUtil.js +0 -30
- package/dist/src/lib/windowUtil.js.map +0 -1
- package/dist/src/nextjs/GetUser.d.ts +0 -6
- package/dist/src/nextjs/GetUser.d.ts.map +0 -1
- package/dist/src/nextjs/GetUser.js +0 -18
- package/dist/src/nextjs/GetUser.js.map +0 -1
- package/dist/src/nextjs/config.d.ts +0 -178
- package/dist/src/nextjs/config.d.ts.map +0 -1
- package/dist/src/nextjs/config.js +0 -161
- package/dist/src/nextjs/config.js.map +0 -1
- package/dist/src/nextjs/cookies.d.ts +0 -30
- package/dist/src/nextjs/cookies.d.ts.map +0 -1
- package/dist/src/nextjs/cookies.js +0 -112
- package/dist/src/nextjs/cookies.js.map +0 -1
- package/dist/src/nextjs/hooks/index.d.ts +0 -2
- package/dist/src/nextjs/hooks/index.d.ts.map +0 -1
- package/dist/src/nextjs/hooks/index.js +0 -2
- package/dist/src/nextjs/hooks/index.js.map +0 -1
- package/dist/src/nextjs/hooks/useTokenCookie.d.ts +0 -3
- package/dist/src/nextjs/hooks/useTokenCookie.d.ts.map +0 -1
- package/dist/src/nextjs/hooks/useTokenCookie.js +0 -37
- package/dist/src/nextjs/hooks/useTokenCookie.js.map +0 -1
- package/dist/src/nextjs/hooks/useUserCookie.d.ts +0 -3
- package/dist/src/nextjs/index.d.ts +0 -7
- package/dist/src/nextjs/index.d.ts.map +0 -1
- package/dist/src/nextjs/index.js +0 -6
- package/dist/src/nextjs/index.js.map +0 -1
- package/dist/src/nextjs/middleware/index.d.ts +0 -2
- package/dist/src/nextjs/middleware/index.d.ts.map +0 -1
- package/dist/src/nextjs/middleware/index.js +0 -2
- package/dist/src/nextjs/middleware/index.js.map +0 -1
- package/dist/src/nextjs/middleware.d.ts +0 -59
- package/dist/src/nextjs/middleware.d.ts.map +0 -1
- package/dist/src/nextjs/middleware.js +0 -107
- package/dist/src/nextjs/middleware.js.map +0 -1
- package/dist/src/nextjs/providers/NextAuthProvider.d.ts +0 -9
- package/dist/src/nextjs/providers/NextAuthProvider.d.ts.map +0 -1
- package/dist/src/nextjs/providers/NextAuthProvider.js +0 -50
- package/dist/src/nextjs/providers/NextAuthProvider.js.map +0 -1
- package/dist/src/nextjs/routeHandler.d.ts +0 -18
- package/dist/src/nextjs/routeHandler.d.ts.map +0 -1
- package/dist/src/nextjs/routeHandler.js +0 -212
- package/dist/src/nextjs/routeHandler.js.map +0 -1
- package/dist/src/nextjs/utils.d.ts +0 -3
- package/dist/src/nextjs/utils.d.ts.map +0 -1
- package/dist/src/nextjs/utils.js +0 -5
- package/dist/src/nextjs/utils.js.map +0 -1
- package/dist/src/reactjs/components/SignInButton.d.ts +0 -8
- package/dist/src/reactjs/components/SignInButton.d.ts.map +0 -1
- package/dist/src/reactjs/components/SignInButton.js +0 -14
- package/dist/src/reactjs/components/SignInButton.js.map +0 -1
- package/dist/src/reactjs/components/SignOutButton.d.ts +0 -6
- package/dist/src/reactjs/components/SignOutButton.d.ts.map +0 -1
- package/dist/src/reactjs/components/SignOutButton.js +0 -14
- package/dist/src/reactjs/components/SignOutButton.js.map +0 -1
- package/dist/src/reactjs/components/UserButton.d.ts +0 -8
- package/dist/src/reactjs/components/UserButton.d.ts.map +0 -1
- package/dist/src/reactjs/components/UserButton.js +0 -118
- package/dist/src/reactjs/components/UserButton.js.map +0 -1
- package/dist/src/reactjs/components/index.d.ts +0 -6
- package/dist/src/reactjs/components/index.d.ts.map +0 -1
- package/dist/src/reactjs/components/index.js +0 -6
- package/dist/src/reactjs/components/index.js.map +0 -1
- package/dist/src/reactjs/hooks/index.d.ts +0 -7
- package/dist/src/reactjs/hooks/index.d.ts.map +0 -1
- package/dist/src/reactjs/hooks/index.js +0 -7
- package/dist/src/reactjs/hooks/index.js.map +0 -1
- package/dist/src/reactjs/hooks/useAuth.d.ts +0 -3
- package/dist/src/reactjs/hooks/useAuth.d.ts.map +0 -1
- package/dist/src/reactjs/hooks/useAuth.js +0 -12
- package/dist/src/reactjs/hooks/useAuth.js.map +0 -1
- package/dist/src/reactjs/hooks/useUser.d.ts +0 -4
- package/dist/src/reactjs/hooks/useUser.d.ts.map +0 -1
- package/dist/src/reactjs/hooks/useUser.js +0 -12
- package/dist/src/reactjs/hooks/useUser.js.map +0 -1
- package/dist/src/reactjs/index.d.ts +0 -6
- package/dist/src/reactjs/index.d.ts.map +0 -1
- package/dist/src/reactjs/index.js +0 -8
- package/dist/src/reactjs/index.js.map +0 -1
- package/dist/src/reactjs/providers/index.d.ts +0 -8
- package/dist/src/reactjs/providers/index.d.ts.map +0 -1
- package/dist/src/reactjs/providers/index.js +0 -7
- package/dist/src/reactjs/providers/index.js.map +0 -1
- package/dist/src/server/ServerAuthenticationResolver.d.ts +0 -19
- package/dist/src/server/ServerAuthenticationResolver.d.ts.map +0 -1
- package/dist/src/server/ServerAuthenticationResolver.js +0 -61
- package/dist/src/server/ServerAuthenticationResolver.js.map +0 -1
- package/dist/src/server/config.d.ts +0 -9
- package/dist/src/server/config.d.ts.map +0 -1
- package/dist/src/server/config.js +0 -2
- package/dist/src/server/config.js.map +0 -1
- package/dist/src/server/index.d.ts +0 -7
- package/dist/src/server/index.d.ts.map +0 -1
- package/dist/src/server/index.js +0 -5
- package/dist/src/server/index.js.map +0 -1
- package/dist/src/server/login.d.ts +0 -17
- package/dist/src/server/login.d.ts.map +0 -1
- package/dist/src/server/login.js +0 -37
- package/dist/src/server/login.js.map +0 -1
- package/dist/src/server/refresh.d.ts +0 -7
- package/dist/src/server/refresh.d.ts.map +0 -1
- package/dist/src/server/refresh.js +0 -13
- package/dist/src/server/refresh.js.map +0 -1
- package/dist/src/services/AuthenticationService.d.ts +0 -87
- package/dist/src/services/AuthenticationService.d.ts.map +0 -1
- package/dist/src/services/AuthenticationService.js +0 -212
- package/dist/src/services/AuthenticationService.js.map +0 -1
- package/dist/src/services/PKCE.d.ts +0 -20
- package/dist/src/services/PKCE.d.ts.map +0 -1
- package/dist/src/services/PKCE.js +0 -44
- package/dist/src/services/PKCE.js.map +0 -1
- package/dist/src/services/types.d.ts +0 -23
- package/dist/src/services/types.d.ts.map +0 -1
- package/dist/src/services/types.js +0 -7
- package/dist/src/services/types.js.map +0 -1
- package/dist/src/shared/components/CivicAuthIframe.d.ts +0 -8
- package/dist/src/shared/components/CivicAuthIframe.d.ts.map +0 -1
- package/dist/src/shared/components/CivicAuthIframe.js +0 -9
- package/dist/src/shared/components/CivicAuthIframe.js.map +0 -1
- package/dist/src/shared/components/CivicAuthIframeContainer.d.ts +0 -9
- package/dist/src/shared/components/CivicAuthIframeContainer.d.ts.map +0 -1
- package/dist/src/shared/components/CivicAuthIframeContainer.js +0 -129
- package/dist/src/shared/components/CivicAuthIframeContainer.js.map +0 -1
- package/dist/src/shared/components/CloseIcon.d.ts +0 -4
- package/dist/src/shared/components/CloseIcon.d.ts.map +0 -1
- package/dist/src/shared/components/CloseIcon.js +0 -6
- package/dist/src/shared/components/CloseIcon.js.map +0 -1
- package/dist/src/shared/components/LoadingIcon.d.ts +0 -4
- package/dist/src/shared/components/LoadingIcon.d.ts.map +0 -1
- package/dist/src/shared/components/LoadingIcon.js +0 -30
- package/dist/src/shared/components/LoadingIcon.js.map +0 -1
- package/dist/src/shared/hooks/index.d.ts +0 -5
- package/dist/src/shared/hooks/index.d.ts.map +0 -1
- package/dist/src/shared/hooks/index.js +0 -5
- package/dist/src/shared/hooks/index.js.map +0 -1
- package/dist/src/shared/hooks/useAuth.d.ts +0 -3
- package/dist/src/shared/hooks/useAuth.d.ts.map +0 -1
- package/dist/src/shared/hooks/useAuth.js +0 -12
- package/dist/src/shared/hooks/useAuth.js.map +0 -1
- package/dist/src/shared/hooks/useConfig.d.ts +0 -3
- package/dist/src/shared/hooks/useConfig.d.ts.map +0 -1
- package/dist/src/shared/hooks/useConfig.js +0 -13
- package/dist/src/shared/hooks/useConfig.js.map +0 -1
- package/dist/src/shared/hooks/useIframe.d.ts +0 -3
- package/dist/src/shared/hooks/useIframe.d.ts.map +0 -1
- package/dist/src/shared/hooks/useIframe.js +0 -13
- package/dist/src/shared/hooks/useIframe.js.map +0 -1
- package/dist/src/shared/hooks/useSession.d.ts +0 -3
- package/dist/src/shared/hooks/useSession.d.ts.map +0 -1
- package/dist/src/shared/hooks/useSession.js +0 -13
- package/dist/src/shared/hooks/useSession.js.map +0 -1
- package/dist/src/shared/hooks/useToken.d.ts +0 -3
- package/dist/src/shared/hooks/useToken.d.ts.map +0 -1
- package/dist/src/shared/hooks/useToken.js +0 -12
- package/dist/src/shared/hooks/useToken.js.map +0 -1
- package/dist/src/shared/lib/GenericAuthenticationRefresher.d.ts +0 -16
- package/dist/src/shared/lib/GenericAuthenticationRefresher.d.ts.map +0 -1
- package/dist/src/shared/lib/GenericAuthenticationRefresher.js +0 -43
- package/dist/src/shared/lib/GenericAuthenticationRefresher.js.map +0 -1
- package/dist/src/shared/lib/UserSession.d.ts +0 -12
- package/dist/src/shared/lib/UserSession.d.ts.map +0 -1
- package/dist/src/shared/lib/UserSession.js +0 -20
- package/dist/src/shared/lib/UserSession.js.map +0 -1
- package/dist/src/shared/lib/session.d.ts +0 -3
- package/dist/src/shared/lib/session.d.ts.map +0 -1
- package/dist/src/shared/lib/session.js +0 -10
- package/dist/src/shared/lib/session.js.map +0 -1
- package/dist/src/shared/lib/storage.d.ts +0 -25
- package/dist/src/shared/lib/storage.d.ts.map +0 -1
- package/dist/src/shared/lib/storage.js +0 -17
- package/dist/src/shared/lib/storage.js.map +0 -1
- package/dist/src/shared/lib/types.d.ts +0 -22
- package/dist/src/shared/lib/types.d.ts.map +0 -1
- package/dist/src/shared/lib/types.js +0 -16
- package/dist/src/shared/lib/types.js.map +0 -1
- package/dist/src/shared/lib/util.d.ts +0 -33
- package/dist/src/shared/lib/util.d.ts.map +0 -1
- package/dist/src/shared/lib/util.js +0 -124
- package/dist/src/shared/lib/util.js.map +0 -1
- package/dist/src/shared/providers/AuthContext.d.ts +0 -10
- package/dist/src/shared/providers/AuthContext.d.ts.map +0 -1
- package/dist/src/shared/providers/AuthContext.js +0 -3
- package/dist/src/shared/providers/AuthContext.js.map +0 -1
- package/dist/src/shared/providers/AuthProvider.d.ts +0 -20
- package/dist/src/shared/providers/AuthProvider.d.ts.map +0 -1
- package/dist/src/shared/providers/AuthProvider.js +0 -264
- package/dist/src/shared/providers/AuthProvider.js.map +0 -1
- package/dist/src/shared/providers/CivicAuthProvider.d.ts +0 -6
- package/dist/src/shared/providers/CivicAuthProvider.d.ts.map +0 -1
- package/dist/src/shared/providers/CivicAuthProvider.js +0 -15
- package/dist/src/shared/providers/CivicAuthProvider.js.map +0 -1
- package/dist/src/shared/providers/ConfigProvider.d.ts +0 -21
- package/dist/src/shared/providers/ConfigProvider.d.ts.map +0 -1
- package/dist/src/shared/providers/ConfigProvider.js +0 -19
- package/dist/src/shared/providers/ConfigProvider.js.map +0 -1
- package/dist/src/shared/providers/IframeProvider.d.ts +0 -16
- package/dist/src/shared/providers/IframeProvider.d.ts.map +0 -1
- package/dist/src/shared/providers/IframeProvider.js +0 -11
- package/dist/src/shared/providers/IframeProvider.js.map +0 -1
- package/dist/src/shared/providers/SessionProvider.d.ts +0 -13
- package/dist/src/shared/providers/SessionProvider.d.ts.map +0 -1
- package/dist/src/shared/providers/SessionProvider.js +0 -13
- package/dist/src/shared/providers/SessionProvider.js.map +0 -1
- package/dist/src/shared/providers/TokenProvider.d.ts +0 -18
- package/dist/src/shared/providers/TokenProvider.d.ts.map +0 -1
- package/dist/src/shared/providers/TokenProvider.js +0 -53
- package/dist/src/shared/providers/TokenProvider.js.map +0 -1
- package/dist/src/shared/providers/UserProvider.d.ts +0 -18
- package/dist/src/shared/providers/UserProvider.d.ts.map +0 -1
- package/dist/src/shared/providers/UserProvider.js +0 -38
- package/dist/src/shared/providers/UserProvider.js.map +0 -1
- package/dist/src/types.d.ts +0 -146
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -2
- package/dist/src/types.js.map +0 -1
- package/dist/src/utils.d.ts +0 -15
- package/dist/src/utils.d.ts.map +0 -1
- package/dist/src/utils.js +0 -43
- package/dist/src/utils.js.map +0 -1
- package/dist/test/integration/sdk.test.d.ts +0 -2
- package/dist/test/integration/sdk.test.d.ts.map +0 -1
- package/dist/test/integration/sdk.test.js +0 -183
- package/dist/test/integration/sdk.test.js.map +0 -1
- package/dist/test/support/fixtures.d.ts +0 -26
- package/dist/test/support/fixtures.d.ts.map +0 -1
- package/dist/test/support/fixtures.js +0 -55
- package/dist/test/support/fixtures.js.map +0 -1
- package/dist/test/support/tokens.json +0 -26
- package/dist/test/unit/lib/oauth.test.d.ts +0 -2
- package/dist/test/unit/lib/oauth.test.d.ts.map +0 -1
- package/dist/test/unit/lib/oauth.test.js +0 -55
- package/dist/test/unit/lib/oauth.test.js.map +0 -1
- package/dist/test/unit/logger.test.d.ts +0 -2
- package/dist/test/unit/logger.test.d.ts.map +0 -1
- package/dist/test/unit/logger.test.js +0 -141
- package/dist/test/unit/logger.test.js.map +0 -1
- package/dist/test/unit/nextjs/NextAuthProvider.test.d.ts +0 -2
- package/dist/test/unit/nextjs/NextAuthProvider.test.d.ts.map +0 -1
- package/dist/test/unit/nextjs/NextAuthProvider.test.js +0 -29
- package/dist/test/unit/nextjs/NextAuthProvider.test.js.map +0 -1
- package/dist/test/unit/nextjs/config.test.d.ts +0 -2
- package/dist/test/unit/nextjs/config.test.d.ts.map +0 -1
- package/dist/test/unit/nextjs/config.test.js +0 -189
- package/dist/test/unit/nextjs/config.test.js.map +0 -1
- package/dist/test/unit/nextjs/getUser.test.d.ts +0 -2
- package/dist/test/unit/nextjs/getUser.test.d.ts.map +0 -1
- package/dist/test/unit/nextjs/getUser.test.js +0 -36
- package/dist/test/unit/nextjs/getUser.test.js.map +0 -1
- package/dist/test/unit/nextjs/middleware.test.d.ts +0 -2
- package/dist/test/unit/nextjs/middleware.test.d.ts.map +0 -1
- package/dist/test/unit/nextjs/middleware.test.js +0 -113
- package/dist/test/unit/nextjs/middleware.test.js.map +0 -1
- package/dist/test/unit/nextjs/utils.test.d.ts +0 -2
- package/dist/test/unit/nextjs/utils.test.d.ts.map +0 -1
- package/dist/test/unit/nextjs/utils.test.js +0 -13
- package/dist/test/unit/nextjs/utils.test.js.map +0 -1
- package/dist/test/unit/publicApi/apiSnapshot.test.d.ts +0 -2
- package/dist/test/unit/publicApi/apiSnapshot.test.d.ts.map +0 -1
- package/dist/test/unit/publicApi/apiSnapshot.test.js +0 -10
- package/dist/test/unit/publicApi/apiSnapshot.test.js.map +0 -1
- package/dist/test/unit/react/components/SignInButton.test.d.ts +0 -2
- package/dist/test/unit/react/components/SignInButton.test.d.ts.map +0 -1
- package/dist/test/unit/react/components/SignInButton.test.js +0 -31
- package/dist/test/unit/react/components/SignInButton.test.js.map +0 -1
- package/dist/test/unit/react/components/SignOutButton.test.d.ts +0 -2
- package/dist/test/unit/react/components/SignOutButton.test.d.ts.map +0 -1
- package/dist/test/unit/react/components/SignOutButton.test.js +0 -30
- package/dist/test/unit/react/components/SignOutButton.test.js.map +0 -1
- package/dist/test/unit/server/login.test.d.ts +0 -2
- package/dist/test/unit/server/login.test.d.ts.map +0 -1
- package/dist/test/unit/server/login.test.js +0 -127
- package/dist/test/unit/server/login.test.js.map +0 -1
- package/dist/test/unit/server/session.test.d.ts +0 -2
- package/dist/test/unit/server/session.test.d.ts.map +0 -1
- package/dist/test/unit/server/session.test.js +0 -41
- package/dist/test/unit/server/session.test.js.map +0 -1
- package/dist/test/unit/services/AuthenticationService.test.d.ts +0 -2
- package/dist/test/unit/services/AuthenticationService.test.d.ts.map +0 -1
- package/dist/test/unit/services/AuthenticationService.test.js +0 -104
- package/dist/test/unit/services/AuthenticationService.test.js.map +0 -1
- package/dist/test/unit/services/ServerAuthenticationResolver.test.d.ts +0 -2
- package/dist/test/unit/services/ServerAuthenticationResolver.test.d.ts.map +0 -1
- package/dist/test/unit/services/ServerAuthenticationResolver.test.js +0 -74
- package/dist/test/unit/services/ServerAuthenticationResolver.test.js.map +0 -1
- package/dist/test/unit/shared/GenericAuthenticationRefresher.test.d.ts +0 -2
- package/dist/test/unit/shared/GenericAuthenticationRefresher.test.d.ts.map +0 -1
- package/dist/test/unit/shared/GenericAuthenticationRefresher.test.js +0 -61
- package/dist/test/unit/shared/GenericAuthenticationRefresher.test.js.map +0 -1
- package/dist/test/unit/shared/UserSession.test.d.ts +0 -2
- package/dist/test/unit/shared/UserSession.test.d.ts.map +0 -1
- package/dist/test/unit/shared/UserSession.test.js +0 -37
- package/dist/test/unit/shared/UserSession.test.js.map +0 -1
- package/dist/test/unit/shared/components/CivicAuthIframeContainer.test.d.ts +0 -2
- package/dist/test/unit/shared/components/CivicAuthIframeContainer.test.d.ts.map +0 -1
- package/dist/test/unit/shared/components/CivicAuthIframeContainer.test.js +0 -120
- package/dist/test/unit/shared/components/CivicAuthIframeContainer.test.js.map +0 -1
- package/dist/test/unit/shared/storage.test.d.ts +0 -2
- package/dist/test/unit/shared/storage.test.d.ts.map +0 -1
- package/dist/test/unit/shared/storage.test.js +0 -53
- package/dist/test/unit/shared/storage.test.js.map +0 -1
- package/dist/test/unit/utils.test.d.ts +0 -2
- package/dist/test/unit/utils.test.d.ts.map +0 -1
- package/dist/test/unit/utils.test.js +0 -40
- package/dist/test/unit/utils.test.js.map +0 -1
- package/dist/vitest.config.d.ts +0 -3
- package/dist/vitest.config.d.ts.map +0 -1
- package/dist/vitest.config.js +0 -40
- package/dist/vitest.config.js.map +0 -1
- package/src/browser/storage.ts +0 -11
- package/src/config.ts +0 -6
- package/src/constants.ts +0 -29
- package/src/index.ts +0 -16
- package/src/lib/cookies.ts +0 -28
- package/src/lib/jwt.ts +0 -15
- package/src/lib/logger.ts +0 -72
- package/src/lib/oauth.ts +0 -83
- package/src/lib/postMessage.ts +0 -22
- package/src/lib/windowUtil.ts +0 -29
- package/src/nextjs/GetUser.ts +0 -22
- package/src/nextjs/config.ts +0 -203
- package/src/nextjs/cookies.ts +0 -162
- package/src/nextjs/hooks/index.ts +0 -1
- package/src/nextjs/hooks/useTokenCookie.ts +0 -41
- package/src/nextjs/hooks/useUserCookie.ts +0 -41
- package/src/nextjs/index.ts +0 -20
- package/src/nextjs/middleware/index.ts +0 -1
- package/src/nextjs/middleware.ts +0 -155
- package/src/nextjs/providers/NextAuthProvider.tsx +0 -87
- package/src/nextjs/routeHandler.ts +0 -297
- package/src/nextjs/utils.ts +0 -9
- package/src/reactjs/components/SignInButton.tsx +0 -32
- package/src/reactjs/components/SignOutButton.tsx +0 -24
- package/src/reactjs/components/UserButton.tsx +0 -239
- package/src/reactjs/components/index.ts +0 -5
- package/src/reactjs/hooks/index.ts +0 -6
- package/src/reactjs/hooks/useAuth.ts +0 -15
- package/src/reactjs/hooks/useUser.ts +0 -20
- package/src/reactjs/index.ts +0 -19
- package/src/reactjs/providers/index.ts +0 -27
- package/src/server/ServerAuthenticationResolver.ts +0 -107
- package/src/server/config.ts +0 -9
- package/src/server/index.ts +0 -13
- package/src/server/login.ts +0 -59
- package/src/server/refresh.ts +0 -23
- package/src/services/AuthenticationService.ts +0 -329
- package/src/services/PKCE.ts +0 -45
- package/src/services/types.ts +0 -54
- package/src/shared/components/CivicAuthIframe.tsx +0 -26
- package/src/shared/components/CivicAuthIframeContainer.tsx +0 -195
- package/src/shared/components/CloseIcon.tsx +0 -21
- package/src/shared/components/LoadingIcon.tsx +0 -53
- package/src/shared/hooks/index.ts +0 -4
- package/src/shared/hooks/useAuth.ts +0 -15
- package/src/shared/hooks/useConfig.ts +0 -14
- package/src/shared/hooks/useIframe.ts +0 -14
- package/src/shared/hooks/useSession.ts +0 -14
- package/src/shared/hooks/useToken.ts +0 -15
- package/src/shared/lib/GenericAuthenticationRefresher.ts +0 -75
- package/src/shared/lib/UserSession.ts +0 -25
- package/src/shared/lib/session.ts +0 -11
- package/src/shared/lib/storage.ts +0 -40
- package/src/shared/lib/types.ts +0 -26
- package/src/shared/lib/util.ts +0 -212
- package/src/shared/providers/AuthContext.tsx +0 -11
- package/src/shared/providers/AuthProvider.tsx +0 -397
- package/src/shared/providers/CivicAuthProvider.tsx +0 -31
- package/src/shared/providers/ConfigProvider.tsx +0 -50
- package/src/shared/providers/IframeProvider.tsx +0 -34
- package/src/shared/providers/SessionProvider.tsx +0 -29
- package/src/shared/providers/TokenProvider.tsx +0 -78
- package/src/shared/providers/UserProvider.tsx +0 -80
- package/src/types.ts +0 -227
- package/src/utils.ts +0 -58
- package/test/integration/sdk.test.tsx +0 -266
- package/test/support/fixtures.ts +0 -56
- package/test/support/tokens.json +0 -26
- package/test/unit/lib/oauth.test.ts +0 -72
- package/test/unit/logger.test.ts +0 -175
- package/test/unit/nextjs/NextAuthProvider.test.tsx +0 -38
- package/test/unit/nextjs/config.test.ts +0 -218
- package/test/unit/nextjs/getUser.test.ts +0 -41
- package/test/unit/nextjs/middleware.test.ts +0 -138
- package/test/unit/nextjs/routeHandler.test.ts.skipped +0 -369
- package/test/unit/nextjs/utils.test.ts +0 -17
- package/test/unit/publicApi/__snapshots__/apiSnapshot.test.ts.snap +0 -17
- package/test/unit/publicApi/apiSnapshot.test.ts +0 -11
- package/test/unit/react/components/SignInButton.test.tsx +0 -50
- package/test/unit/react/components/SignOutButton.test.tsx +0 -49
- package/test/unit/server/login.test.ts +0 -181
- package/test/unit/server/session.test.ts +0 -51
- package/test/unit/services/AuthenticationService.test.ts +0 -152
- package/test/unit/services/ServerAuthenticationResolver.test.ts +0 -115
- package/test/unit/shared/GenericAuthenticationRefresher.test.ts +0 -89
- package/test/unit/shared/UserSession.test.ts +0 -42
- package/test/unit/shared/components/CivicAuthIframeContainer.test.tsx +0 -154
- package/test/unit/shared/storage.test.ts +0 -67
- package/test/unit/utils.test.ts +0 -48
- package/tsconfig.build.json +0 -9
- package/tsconfig.cjs.json +0 -8
- package/tsconfig.esm.json +0 -7
- package/tsconfig.json +0 -42
- package/tsconfig.tsbuildinfo +0 -1
- package/vitest.config.ts +0 -41
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { useUser } from "@/reactjs/hooks/useUser.js";
|
|
4
|
-
|
|
5
|
-
const SignOutButton = ({ className }: { className?: string }) => {
|
|
6
|
-
const { signOut } = useUser();
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
<button
|
|
10
|
-
style={{
|
|
11
|
-
borderRadius: "9999px",
|
|
12
|
-
border: "1px solid #6b7280",
|
|
13
|
-
padding: "0.75rem 1rem",
|
|
14
|
-
transition: "background-color 0.2s",
|
|
15
|
-
}}
|
|
16
|
-
className={className}
|
|
17
|
-
onClick={() => signOut()}
|
|
18
|
-
>
|
|
19
|
-
Sign Out
|
|
20
|
-
</button>
|
|
21
|
-
);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export { SignOutButton };
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useUser } from "@/reactjs/hooks/index.js";
|
|
3
|
-
import type { DisplayMode } from "@/types.js";
|
|
4
|
-
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
5
|
-
|
|
6
|
-
const ChevronDown = () => (
|
|
7
|
-
<svg
|
|
8
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
-
width="24"
|
|
10
|
-
height="24"
|
|
11
|
-
viewBox="0 0 24 24"
|
|
12
|
-
fill="none"
|
|
13
|
-
stroke="currentColor"
|
|
14
|
-
strokeWidth="2"
|
|
15
|
-
strokeLinecap="round"
|
|
16
|
-
strokeLinejoin="round"
|
|
17
|
-
className="lucide lucide-chevron-down"
|
|
18
|
-
>
|
|
19
|
-
<path d="m6 9 6 6 6-6" />
|
|
20
|
-
</svg>
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
const ChevronUp = () => (
|
|
24
|
-
<svg
|
|
25
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
26
|
-
width="24"
|
|
27
|
-
height="24"
|
|
28
|
-
viewBox="0 0 24 24"
|
|
29
|
-
fill="none"
|
|
30
|
-
stroke="currentColor"
|
|
31
|
-
strokeWidth="2"
|
|
32
|
-
strokeLinecap="round"
|
|
33
|
-
strokeLinejoin="round"
|
|
34
|
-
className="lucide lucide-chevron-up"
|
|
35
|
-
>
|
|
36
|
-
<path d="m18 15-6-6-6 6" />
|
|
37
|
-
</svg>
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
const UserButton = ({
|
|
41
|
-
displayMode,
|
|
42
|
-
className,
|
|
43
|
-
}: {
|
|
44
|
-
displayMode?: DisplayMode;
|
|
45
|
-
className?: string;
|
|
46
|
-
}) => {
|
|
47
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
48
|
-
const [buttonWidth, setButtonWidth] = useState<number | null>(null);
|
|
49
|
-
const { user, signIn, signOut } = useUser();
|
|
50
|
-
const buttonRef = useRef<HTMLButtonElement>(null);
|
|
51
|
-
const dropdownRef = useRef<HTMLDivElement>(null);
|
|
52
|
-
|
|
53
|
-
useEffect(() => {
|
|
54
|
-
if (buttonRef.current) {
|
|
55
|
-
setButtonWidth(buttonRef.current.offsetWidth);
|
|
56
|
-
}
|
|
57
|
-
}, [isOpen]);
|
|
58
|
-
|
|
59
|
-
const handleClickOutside = useCallback((event: MouseEvent) => {
|
|
60
|
-
const target = event.target as HTMLElement;
|
|
61
|
-
|
|
62
|
-
if (
|
|
63
|
-
buttonRef.current &&
|
|
64
|
-
dropdownRef.current &&
|
|
65
|
-
!buttonRef.current.contains(target) &&
|
|
66
|
-
!dropdownRef.current.contains(target)
|
|
67
|
-
) {
|
|
68
|
-
setIsOpen(false);
|
|
69
|
-
}
|
|
70
|
-
}, []);
|
|
71
|
-
|
|
72
|
-
const handleSignOut = useCallback(async () => {
|
|
73
|
-
signOut();
|
|
74
|
-
|
|
75
|
-
setIsOpen(false);
|
|
76
|
-
}, [signOut]);
|
|
77
|
-
|
|
78
|
-
const handleSignIn = useCallback(async () => {
|
|
79
|
-
await signIn(displayMode);
|
|
80
|
-
|
|
81
|
-
setIsOpen(false);
|
|
82
|
-
}, [signIn, displayMode]);
|
|
83
|
-
|
|
84
|
-
const handleEscape = useCallback((event: KeyboardEvent) => {
|
|
85
|
-
if (event.key === "Escape") {
|
|
86
|
-
setIsOpen(false);
|
|
87
|
-
}
|
|
88
|
-
}, []);
|
|
89
|
-
|
|
90
|
-
useEffect(() => {
|
|
91
|
-
if (isOpen) {
|
|
92
|
-
window.addEventListener("click", handleClickOutside);
|
|
93
|
-
|
|
94
|
-
window.addEventListener("keydown", handleEscape);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return () => {
|
|
98
|
-
window.removeEventListener("click", handleClickOutside);
|
|
99
|
-
|
|
100
|
-
window.removeEventListener("keydown", handleEscape);
|
|
101
|
-
};
|
|
102
|
-
}, [handleClickOutside, handleEscape, isOpen]);
|
|
103
|
-
|
|
104
|
-
if (user) {
|
|
105
|
-
return (
|
|
106
|
-
<div
|
|
107
|
-
style={{ position: "relative", width: "auto" }}
|
|
108
|
-
id="civic-dropdown-container"
|
|
109
|
-
>
|
|
110
|
-
<button
|
|
111
|
-
ref={buttonRef}
|
|
112
|
-
style={{
|
|
113
|
-
cursor: "pointer",
|
|
114
|
-
display: "flex",
|
|
115
|
-
minWidth: "10rem",
|
|
116
|
-
alignItems: "center",
|
|
117
|
-
justifyContent: "space-between",
|
|
118
|
-
gap: "0.5rem",
|
|
119
|
-
borderRadius: "9999px",
|
|
120
|
-
border: "1px solid #6b7280",
|
|
121
|
-
padding: "0.75rem 1rem",
|
|
122
|
-
color: "#6b7280",
|
|
123
|
-
background: "none",
|
|
124
|
-
transition: "background-color 0.2s",
|
|
125
|
-
}}
|
|
126
|
-
className={className}
|
|
127
|
-
onMouseEnter={(e) =>
|
|
128
|
-
(e.currentTarget.style.backgroundColor = "#f3f4f6")
|
|
129
|
-
}
|
|
130
|
-
onMouseLeave={(e) =>
|
|
131
|
-
(e.currentTarget.style.backgroundColor = "transparent")
|
|
132
|
-
}
|
|
133
|
-
onClick={() => {
|
|
134
|
-
setIsOpen((isOpen) => !isOpen);
|
|
135
|
-
}}
|
|
136
|
-
>
|
|
137
|
-
{user?.picture ? (
|
|
138
|
-
<span
|
|
139
|
-
style={{
|
|
140
|
-
position: "relative",
|
|
141
|
-
display: "flex",
|
|
142
|
-
height: "1.5rem",
|
|
143
|
-
width: "1.5rem",
|
|
144
|
-
flexShrink: 0,
|
|
145
|
-
gap: "0.5rem",
|
|
146
|
-
overflow: "hidden",
|
|
147
|
-
borderRadius: "9999px",
|
|
148
|
-
}}
|
|
149
|
-
>
|
|
150
|
-
<img
|
|
151
|
-
style={{ height: "100%", width: "100%", objectFit: "cover" }}
|
|
152
|
-
src={user.picture}
|
|
153
|
-
alt={user?.name || user?.email}
|
|
154
|
-
/>
|
|
155
|
-
</span>
|
|
156
|
-
) : (
|
|
157
|
-
<div />
|
|
158
|
-
)}
|
|
159
|
-
|
|
160
|
-
<span>{user?.name || user?.email}</span>
|
|
161
|
-
|
|
162
|
-
<div style={{ pointerEvents: "none" }}>
|
|
163
|
-
{isOpen ? <ChevronUp /> : <ChevronDown />}
|
|
164
|
-
</div>
|
|
165
|
-
</button>
|
|
166
|
-
<div
|
|
167
|
-
ref={dropdownRef}
|
|
168
|
-
style={
|
|
169
|
-
isOpen
|
|
170
|
-
? {
|
|
171
|
-
position: "absolute",
|
|
172
|
-
left: 0,
|
|
173
|
-
width: buttonWidth || "auto",
|
|
174
|
-
marginTop: "0.5rem",
|
|
175
|
-
borderRadius: "0.5rem",
|
|
176
|
-
backgroundColor: "white",
|
|
177
|
-
padding: "0.5rem 0",
|
|
178
|
-
color: "#6b7280",
|
|
179
|
-
boxShadow:
|
|
180
|
-
"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",
|
|
181
|
-
}
|
|
182
|
-
: { display: "none" }
|
|
183
|
-
}
|
|
184
|
-
>
|
|
185
|
-
<ul style={{ listStyleType: "none", margin: 0, padding: 0 }}>
|
|
186
|
-
<li>
|
|
187
|
-
<button
|
|
188
|
-
style={{
|
|
189
|
-
display: "block",
|
|
190
|
-
width: "100%",
|
|
191
|
-
padding: "0.5rem 1rem",
|
|
192
|
-
transition: "background-color 0.2s",
|
|
193
|
-
background: "none",
|
|
194
|
-
border: "none",
|
|
195
|
-
textAlign: "center",
|
|
196
|
-
cursor: "pointer",
|
|
197
|
-
}}
|
|
198
|
-
onClick={handleSignOut}
|
|
199
|
-
onMouseEnter={(e) =>
|
|
200
|
-
(e.currentTarget.style.backgroundColor = "#f3f4f6")
|
|
201
|
-
}
|
|
202
|
-
onMouseLeave={(e) =>
|
|
203
|
-
(e.currentTarget.style.backgroundColor = "transparent")
|
|
204
|
-
}
|
|
205
|
-
>
|
|
206
|
-
Logout
|
|
207
|
-
</button>
|
|
208
|
-
</li>
|
|
209
|
-
</ul>
|
|
210
|
-
</div>
|
|
211
|
-
</div>
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
return (
|
|
216
|
-
<button
|
|
217
|
-
ref={buttonRef}
|
|
218
|
-
data-testid="sign-in-button"
|
|
219
|
-
style={{
|
|
220
|
-
cursor: "pointer",
|
|
221
|
-
borderRadius: "9999px",
|
|
222
|
-
border: "1px solid #6b7280",
|
|
223
|
-
padding: "0.75rem 1rem",
|
|
224
|
-
background: "none",
|
|
225
|
-
transition: "background-color 0.2s",
|
|
226
|
-
}}
|
|
227
|
-
className={className}
|
|
228
|
-
onMouseEnter={(e) => (e.currentTarget.style.backgroundColor = "#f3f4f6")}
|
|
229
|
-
onMouseLeave={(e) =>
|
|
230
|
-
(e.currentTarget.style.backgroundColor = "transparent")
|
|
231
|
-
}
|
|
232
|
-
onClick={handleSignIn}
|
|
233
|
-
>
|
|
234
|
-
Sign in
|
|
235
|
-
</button>
|
|
236
|
-
);
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
export { UserButton };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { CivicAuthIframe } from "@/shared/components/CivicAuthIframe.js";
|
|
2
|
-
export { CivicAuthIframeContainer } from "@/shared/components/CivicAuthIframeContainer.js";
|
|
3
|
-
export { UserButton } from "@/reactjs/components/UserButton.js";
|
|
4
|
-
export { SignInButton } from "@/reactjs/components/SignInButton.js";
|
|
5
|
-
export { SignOutButton } from "@/reactjs/components/SignOutButton.js";
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { useUser } from "@/reactjs/hooks/useUser.js";
|
|
2
|
-
export { useToken } from "@/shared/hooks/useToken.js";
|
|
3
|
-
export { useAuth } from "@/shared/hooks/useAuth.js";
|
|
4
|
-
export { useSession } from "@/shared/hooks/useSession.js";
|
|
5
|
-
export { useConfig } from "@/shared/hooks/useConfig.js";
|
|
6
|
-
export { useIframe } from "@/shared/hooks/useIframe.js";
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useContext } from "react";
|
|
3
|
-
import { AuthContext } from "@/shared/providers/AuthContext.js";
|
|
4
|
-
|
|
5
|
-
const useAuth = () => {
|
|
6
|
-
const context = useContext(AuthContext);
|
|
7
|
-
|
|
8
|
-
if (!context) {
|
|
9
|
-
throw new Error("useAuth must be used within an AuthProvider");
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return context;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export { useAuth };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useContext } from "react";
|
|
3
|
-
import {
|
|
4
|
-
UserContext,
|
|
5
|
-
type UserContextType,
|
|
6
|
-
} from "@/shared/providers/UserProvider.js";
|
|
7
|
-
|
|
8
|
-
const useUser = <
|
|
9
|
-
T extends Record<string, unknown> = Record<string, never>,
|
|
10
|
-
>(): UserContextType<T> => {
|
|
11
|
-
const context = useContext(UserContext);
|
|
12
|
-
|
|
13
|
-
if (!context) {
|
|
14
|
-
throw new Error("useUser must be used within a UserProvider");
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return context as UserContextType<T>;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export { useUser };
|
package/src/reactjs/index.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// These are the default exports of the project.
|
|
2
|
-
// They are limited by design to ensure that the public API does not expose any internal implementation details.
|
|
3
|
-
// Do not change this without thinking carefully about the impact on the client-facing public API.
|
|
4
|
-
export * from "@/reactjs/hooks/index.js";
|
|
5
|
-
export {
|
|
6
|
-
CivicAuthProvider,
|
|
7
|
-
type CivicAuthProviderProps,
|
|
8
|
-
} from "@/reactjs/providers/index.js";
|
|
9
|
-
export type {
|
|
10
|
-
AuthContextType,
|
|
11
|
-
TokenContextType,
|
|
12
|
-
UserContextType,
|
|
13
|
-
} from "@/reactjs/providers/index.js";
|
|
14
|
-
export { CivicAuthIframeContainer } from "@/shared/components/CivicAuthIframeContainer.js";
|
|
15
|
-
export {
|
|
16
|
-
UserButton,
|
|
17
|
-
SignInButton,
|
|
18
|
-
SignOutButton,
|
|
19
|
-
} from "@/reactjs/components/index.js";
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
UserProvider,
|
|
3
|
-
UserContext,
|
|
4
|
-
type UserContextType,
|
|
5
|
-
} from "@/shared/providers/UserProvider.js";
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
TokenProvider,
|
|
9
|
-
TokenContext,
|
|
10
|
-
type TokenContextType,
|
|
11
|
-
} from "@/shared/providers/TokenProvider.js";
|
|
12
|
-
|
|
13
|
-
export { AuthProvider } from "@/shared/providers/AuthProvider.js";
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
SessionProvider,
|
|
17
|
-
SessionContext,
|
|
18
|
-
type SessionContextType,
|
|
19
|
-
} from "@/shared/providers/SessionProvider.js";
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
CivicAuthProvider,
|
|
23
|
-
type CivicAuthProviderProps,
|
|
24
|
-
} from "@/shared/providers/CivicAuthProvider.js";
|
|
25
|
-
|
|
26
|
-
export { AuthContext } from "@/shared/providers/AuthContext.js";
|
|
27
|
-
export type { AuthContextType } from "@/shared/providers/AuthContext.js";
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { GenericPublicClientPKCEProducer } from "@/services/PKCE.js";
|
|
2
|
-
import { OAuth2Client } from "oslo/oauth2";
|
|
3
|
-
import type {
|
|
4
|
-
AuthStorage,
|
|
5
|
-
Endpoints,
|
|
6
|
-
OIDCTokenResponseBody,
|
|
7
|
-
SessionData,
|
|
8
|
-
} from "@/types.js";
|
|
9
|
-
import type { AuthConfig } from "@/server/config.js";
|
|
10
|
-
import {
|
|
11
|
-
exchangeTokens,
|
|
12
|
-
getEndpointsWithOverrides,
|
|
13
|
-
retrieveTokens,
|
|
14
|
-
storeTokens,
|
|
15
|
-
} from "@/shared/lib/util.js";
|
|
16
|
-
import type { AuthenticationResolver, PKCEProducer } from "@/services/types.ts";
|
|
17
|
-
import { DEFAULT_AUTH_SERVER } from "@/constants.js";
|
|
18
|
-
|
|
19
|
-
export class ServerAuthenticationResolver implements AuthenticationResolver {
|
|
20
|
-
private pkceProducer: PKCEProducer;
|
|
21
|
-
private oauth2client: OAuth2Client | undefined;
|
|
22
|
-
private endpoints: Endpoints | undefined;
|
|
23
|
-
|
|
24
|
-
private constructor(
|
|
25
|
-
readonly authConfig: AuthConfig,
|
|
26
|
-
readonly storage: AuthStorage,
|
|
27
|
-
readonly endpointOverrides?: Partial<Endpoints>,
|
|
28
|
-
) {
|
|
29
|
-
this.pkceProducer = new GenericPublicClientPKCEProducer(storage);
|
|
30
|
-
}
|
|
31
|
-
validateExistingSession(): Promise<SessionData> {
|
|
32
|
-
throw new Error("Method not implemented.");
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
get oauthServer(): string {
|
|
36
|
-
return this.authConfig.oauthServer || DEFAULT_AUTH_SERVER;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async init(): Promise<this> {
|
|
40
|
-
// resolve oauth config
|
|
41
|
-
this.endpoints = await getEndpointsWithOverrides(
|
|
42
|
-
this.oauthServer,
|
|
43
|
-
this.endpointOverrides,
|
|
44
|
-
);
|
|
45
|
-
this.oauth2client = new OAuth2Client(
|
|
46
|
-
this.authConfig.clientId,
|
|
47
|
-
this.endpoints.auth,
|
|
48
|
-
this.endpoints.token,
|
|
49
|
-
{
|
|
50
|
-
redirectURI: this.authConfig.redirectUrl,
|
|
51
|
-
},
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
return this;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async tokenExchange(
|
|
58
|
-
code: string,
|
|
59
|
-
state: string,
|
|
60
|
-
): Promise<OIDCTokenResponseBody> {
|
|
61
|
-
if (!this.oauth2client) await this.init();
|
|
62
|
-
const codeVerifier = await this.pkceProducer.getCodeVerifier();
|
|
63
|
-
if (!codeVerifier) throw new Error("Code verifier not found in storage");
|
|
64
|
-
|
|
65
|
-
// exchange auth code for tokens
|
|
66
|
-
const tokens = await exchangeTokens(
|
|
67
|
-
code,
|
|
68
|
-
state,
|
|
69
|
-
this.pkceProducer,
|
|
70
|
-
this.oauth2client!, // clean up types here to avoid the ! operator
|
|
71
|
-
this.oauthServer,
|
|
72
|
-
this.endpoints!, // clean up types here to avoid the ! operator
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
await storeTokens(this.storage, tokens);
|
|
76
|
-
|
|
77
|
-
return tokens;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
async getSessionData(): Promise<SessionData | null> {
|
|
81
|
-
const storageData = await retrieveTokens(this.storage);
|
|
82
|
-
|
|
83
|
-
if (!storageData) return null;
|
|
84
|
-
|
|
85
|
-
return {
|
|
86
|
-
authenticated: !!storageData.id_token,
|
|
87
|
-
idToken: storageData.id_token,
|
|
88
|
-
accessToken: storageData.access_token,
|
|
89
|
-
refreshToken: storageData.refresh_token,
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
static async build(
|
|
94
|
-
authConfig: AuthConfig,
|
|
95
|
-
storage: AuthStorage,
|
|
96
|
-
endpointOverrides?: Partial<Endpoints>,
|
|
97
|
-
): Promise<AuthenticationResolver> {
|
|
98
|
-
const resolver = new ServerAuthenticationResolver(
|
|
99
|
-
authConfig,
|
|
100
|
-
storage,
|
|
101
|
-
endpointOverrides,
|
|
102
|
-
);
|
|
103
|
-
await resolver.init();
|
|
104
|
-
|
|
105
|
-
return resolver;
|
|
106
|
-
}
|
|
107
|
-
}
|
package/src/server/config.ts
DELETED
package/src/server/index.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export { CookieStorage } from "@/shared/lib/storage.js";
|
|
2
|
-
export type {
|
|
3
|
-
SessionStorage,
|
|
4
|
-
CookieStorageSettings,
|
|
5
|
-
} from "@/shared/lib/storage.js";
|
|
6
|
-
export {
|
|
7
|
-
resolveOAuthAccessCode,
|
|
8
|
-
isLoggedIn,
|
|
9
|
-
buildLoginUrl,
|
|
10
|
-
} from "@/server/login.js";
|
|
11
|
-
export type { AuthConfig } from "@/server/config.js";
|
|
12
|
-
export { getUser } from "@/shared/lib/session.js";
|
|
13
|
-
export { refreshTokens } from "@/server/refresh.js";
|
package/src/server/login.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { AuthStorage, OIDCTokenResponseBody } from "@/types.js";
|
|
2
|
-
import { DEFAULT_AUTH_SERVER, DEFAULT_SCOPES } from "@/constants.js";
|
|
3
|
-
import { GenericAuthenticationInitiator } from "@/services/AuthenticationService.js";
|
|
4
|
-
import { GenericPublicClientPKCEProducer } from "@/services/PKCE.js";
|
|
5
|
-
import { ServerAuthenticationResolver } from "@/server/ServerAuthenticationResolver.js";
|
|
6
|
-
import type { AuthConfig } from "@/server/config.ts";
|
|
7
|
-
/**
|
|
8
|
-
* Resolve an OAuth access code to a set of OIDC tokens
|
|
9
|
-
* @param code The access code, typically from a query parameter in the redirect url
|
|
10
|
-
* @param state The oauth random state string, used to distinguish between requests. Typically also passed in the redirect url
|
|
11
|
-
* @param storage The place that this server uses to store session data (e.g. a cookie store)
|
|
12
|
-
* @param config Oauth Server configuration
|
|
13
|
-
*/
|
|
14
|
-
export async function resolveOAuthAccessCode(
|
|
15
|
-
code: string,
|
|
16
|
-
state: string,
|
|
17
|
-
storage: AuthStorage,
|
|
18
|
-
config: AuthConfig,
|
|
19
|
-
): Promise<OIDCTokenResponseBody> {
|
|
20
|
-
const authSessionService = await ServerAuthenticationResolver.build(
|
|
21
|
-
{
|
|
22
|
-
...config,
|
|
23
|
-
oauthServer: config.oauthServer ?? DEFAULT_AUTH_SERVER,
|
|
24
|
-
},
|
|
25
|
-
storage,
|
|
26
|
-
config.endpointOverrides,
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
return authSessionService.tokenExchange(code, state);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export async function isLoggedIn(storage: AuthStorage): Promise<boolean> {
|
|
33
|
-
return !!(await storage.get("id_token"));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export async function buildLoginUrl(
|
|
37
|
-
config: Pick<AuthConfig, "clientId" | "redirectUrl"> &
|
|
38
|
-
Partial<Pick<AuthConfig, "oauthServer">> & {
|
|
39
|
-
scopes?: string[];
|
|
40
|
-
state?: string;
|
|
41
|
-
nonce?: string;
|
|
42
|
-
},
|
|
43
|
-
storage: AuthStorage,
|
|
44
|
-
): Promise<URL> {
|
|
45
|
-
// generate a random state if not provided
|
|
46
|
-
const state = config.state ?? Math.random().toString(36).substring(2);
|
|
47
|
-
const scopes = config.scopes ?? DEFAULT_SCOPES;
|
|
48
|
-
const pkceProducer = new GenericPublicClientPKCEProducer(storage);
|
|
49
|
-
const authInitiator = new GenericAuthenticationInitiator({
|
|
50
|
-
...config,
|
|
51
|
-
state,
|
|
52
|
-
scopes,
|
|
53
|
-
oauthServer: config.oauthServer ?? DEFAULT_AUTH_SERVER,
|
|
54
|
-
// When retrieving the PKCE challenge on the server-side, we produce it and store it in the session
|
|
55
|
-
pkceConsumer: pkceProducer,
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
return authInitiator.signIn();
|
|
59
|
-
}
|
package/src/server/refresh.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { AuthStorage, OIDCTokenResponseBody } from "@/types.js";
|
|
2
|
-
import { DEFAULT_AUTH_SERVER } from "@/constants.js";
|
|
3
|
-
import { GenericAuthenticationRefresher } from "@/shared/lib/GenericAuthenticationRefresher.js";
|
|
4
|
-
import type { AuthConfig } from "@/server/config.ts";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Refresh the current set of OIDC tokens
|
|
8
|
-
*/
|
|
9
|
-
export async function refreshTokens(
|
|
10
|
-
storage: AuthStorage,
|
|
11
|
-
config: AuthConfig,
|
|
12
|
-
): Promise<OIDCTokenResponseBody> {
|
|
13
|
-
const refresher = await GenericAuthenticationRefresher.build(
|
|
14
|
-
{
|
|
15
|
-
...config,
|
|
16
|
-
oauthServer: config.oauthServer ?? DEFAULT_AUTH_SERVER,
|
|
17
|
-
},
|
|
18
|
-
storage,
|
|
19
|
-
config.endpointOverrides,
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
return refresher.refreshTokens();
|
|
23
|
-
}
|