@burdenoff/microfe-auth 2026.718.4 → 2026.725.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/AuthRoot.d.ts +29 -0
- package/dist/auth/AuthRoutes.d.ts +27 -0
- package/dist/auth/components/AuthIcons.d.ts +16 -0
- package/dist/auth/components/AuthLayout.d.ts +16 -0
- package/dist/auth/components/CaptchaV2.d.ts +25 -0
- package/dist/auth/components/ConfirmActionDialog.d.ts +15 -0
- package/dist/auth/components/index.d.ts +3 -0
- package/dist/auth/components/profile/UserProfileMenu.d.ts +41 -0
- package/dist/auth/components/workspace/WorkspaceSelector.d.ts +49 -0
- package/dist/auth/constants/permissions.d.ts +29 -0
- package/dist/auth/constants/sessionKeys.d.ts +17 -0
- package/dist/auth/hooks/index.d.ts +19 -0
- package/dist/auth/hooks/useAccountOperations.d.ts +18 -0
- package/dist/auth/hooks/useActiveContextBootstrapMirror.d.ts +91 -0
- package/dist/auth/hooks/useApiKeyOperations.d.ts +28 -0
- package/dist/auth/hooks/useAppOperations.d.ts +32 -0
- package/dist/auth/hooks/useAuthOperations.d.ts +59 -0
- package/dist/auth/hooks/useAuthPermissions.d.ts +19 -0
- package/dist/auth/hooks/useCaptchaV3.d.ts +12 -0
- package/dist/auth/hooks/useContextSwitcherData.d.ts +91 -0
- package/dist/auth/hooks/useDelegationOperations.d.ts +38 -0
- package/dist/auth/hooks/useMfaOperations.d.ts +17 -0
- package/dist/auth/hooks/useMyWorkspaces.d.ts +47 -0
- package/dist/auth/hooks/useOAuthOperations.d.ts +18 -0
- package/dist/auth/hooks/usePasswordOperations.d.ts +12 -0
- package/dist/auth/hooks/useSessionOperations.d.ts +57 -0
- package/dist/auth/hooks/useSignupCaptcha.d.ts +22 -0
- package/dist/auth/hooks/useSsoOperations.d.ts +67 -0
- package/dist/auth/hooks/useTokenRefresh.d.ts +55 -0
- package/dist/auth/hooks/useUserOperations.d.ts +32 -0
- package/dist/auth/hooks/useWorkspaceOperations.d.ts +34 -0
- package/dist/auth/hooks/useWorkspaceToken.d.ts +55 -0
- package/dist/auth/index.d.ts +63 -0
- package/dist/auth/pages/AuditLogPage.d.ts +11 -0
- package/dist/auth/pages/EmailVerifyPage.d.ts +4 -0
- package/dist/auth/pages/LoginPage.d.ts +5 -0
- package/dist/auth/pages/MagicLinkPage.d.ts +5 -0
- package/dist/auth/pages/MfaSetupPage.d.ts +4 -0
- package/dist/auth/pages/MfaVerifyPage.d.ts +6 -0
- package/dist/auth/pages/OAuthCallbackPage.d.ts +6 -0
- package/dist/auth/pages/PasswordResetPage.d.ts +5 -0
- package/dist/auth/pages/ReactivatePage.d.ts +5 -0
- package/dist/auth/pages/RegisterPage.d.ts +4 -0
- package/dist/auth/pages/SSOClearPage.d.ts +21 -0
- package/dist/auth/pages/SSODepositPage.d.ts +23 -0
- package/dist/auth/pages/SSORelayCallbackPage.d.ts +7 -0
- package/dist/auth/pages/SSORelayPage.d.ts +17 -0
- package/dist/auth/pages/SecurityPage.d.ts +6 -0
- package/dist/auth/pages/SessionBridgePage.d.ts +13 -0
- package/dist/auth/pages/SessionsPage.d.ts +7 -0
- package/dist/auth/pages/SsoCallbackPage.d.ts +7 -0
- package/dist/auth/pages/SsoConfigPage.d.ts +12 -0
- package/dist/auth/pages/SsoLoginPage.d.ts +6 -0
- package/dist/auth/pages/UserDetailsPage.d.ts +10 -0
- package/dist/auth/pages/UserDetailsPage.js.map +1 -1
- package/dist/auth/pages/UserProfilePage.d.ts +4 -0
- package/dist/auth/pages/UsersPage.d.ts +4 -0
- package/dist/auth/providers/AuthProvider.d.ts +17 -0
- package/dist/auth/providers/CaptchaProvider.d.ts +12 -0
- package/dist/auth/store/authStore.d.ts +110 -0
- package/dist/auth/types/index.d.ts +678 -0
- package/dist/auth/utils/captchaConfig.d.ts +3 -0
- package/dist/auth/utils/formatters.d.ts +36 -0
- package/dist/auth/utils/gatewayBaseUrls.d.ts +5 -0
- package/dist/auth/utils/index.d.ts +2 -0
- package/dist/auth/utils/ssoOrigins.d.ts +28 -0
- package/dist/auth/utils/validation.d.ts +29 -0
- package/dist/dev/main.d.ts +1 -0
- package/dist/generated/global-operations.d.ts +3095 -0
- package/dist/generated/global-types.d.ts +23528 -0
- package/dist/generated/wspace-operations.d.ts +123 -0
- package/dist/generated/wspace-types.d.ts +57850 -0
- package/dist/index.d.ts +3 -0
- package/dist/shared/hooks/index.d.ts +6 -0
- package/dist/shared/index.d.ts +5 -0
- package/dist/shared/types/index.d.ts +108 -0
- package/dist/translations/en.d.ts +320 -0
- package/dist/utils/nativeBridge.d.ts +2 -0
- package/package.json +4 -2
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AppUserDelegation, GrantDelegationInput } from '../types';
|
|
2
|
+
|
|
3
|
+
interface CurrentUserDelegationsResponse {
|
|
4
|
+
currentUserDelegations: {
|
|
5
|
+
delegations: AppUserDelegation[];
|
|
6
|
+
hasMore: boolean;
|
|
7
|
+
totalCount: number;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
interface CurrentUserGrantedDelegationsResponse {
|
|
11
|
+
currentUserGrantedDelegations: {
|
|
12
|
+
delegations: AppUserDelegation[];
|
|
13
|
+
hasMore: boolean;
|
|
14
|
+
totalCount: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Hook for app-user delegation operations
|
|
19
|
+
*/
|
|
20
|
+
export declare function useDelegationOperations(): {
|
|
21
|
+
grantDelegation: (input: GrantDelegationInput) => Promise<AppUserDelegation>;
|
|
22
|
+
revokeDelegation: (id: string, reason?: string) => Promise<boolean>;
|
|
23
|
+
getDelegationsForApp: (appId: string) => AppUserDelegation[];
|
|
24
|
+
hasWorkspaceDelegation: (appId: string, workspaceId: string) => boolean;
|
|
25
|
+
refetchDelegations: (variables?: Partial<import('@apollo/client').OperationVariables> | undefined) => Promise<{
|
|
26
|
+
data: CurrentUserDelegationsResponse | undefined;
|
|
27
|
+
error?: import('@apollo/client').ErrorLike;
|
|
28
|
+
}>;
|
|
29
|
+
refetchGrantedDelegations: (variables?: Partial<import('@apollo/client').OperationVariables> | undefined) => Promise<{
|
|
30
|
+
data: CurrentUserGrantedDelegationsResponse | undefined;
|
|
31
|
+
error?: import('@apollo/client').ErrorLike;
|
|
32
|
+
}>;
|
|
33
|
+
delegations: AppUserDelegation[];
|
|
34
|
+
grantedDelegations: AppUserDelegation[];
|
|
35
|
+
isLoading: boolean;
|
|
36
|
+
error: string | null;
|
|
37
|
+
};
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MFAMethod, MFASetupResult, MFAVerifyInput, AuthResult } from '../types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Hook for MFA operations
|
|
5
|
+
*/
|
|
6
|
+
export declare function useMfaOperations(): {
|
|
7
|
+
setupMFA: (method: MFAMethod) => Promise<MFASetupResult>;
|
|
8
|
+
enableMFA: (code: string) => Promise<boolean>;
|
|
9
|
+
verifyMFA: (input: MFAVerifyInput) => Promise<AuthResult>;
|
|
10
|
+
disableMFA: () => Promise<boolean>;
|
|
11
|
+
enableMfa: (code: string) => Promise<boolean>;
|
|
12
|
+
verifyMfa: (input: MFAVerifyInput) => Promise<AuthResult>;
|
|
13
|
+
disableMfa: () => Promise<boolean>;
|
|
14
|
+
mfaRequired: boolean;
|
|
15
|
+
mfaChallengeId: string | null;
|
|
16
|
+
isLoading: boolean;
|
|
17
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Workspace } from '../types';
|
|
2
|
+
|
|
3
|
+
interface MyWorkspacesResponse {
|
|
4
|
+
myWorkspaces: {
|
|
5
|
+
total: number;
|
|
6
|
+
items: Workspace[];
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Hook for fetching user's workspaces and issuing workspace tokens
|
|
11
|
+
*
|
|
12
|
+
* This hook provides:
|
|
13
|
+
* - Fetch workspaces: Query to get all workspaces the user has access to
|
|
14
|
+
* - Issue workspace token: Get a workspace-scoped token for API access
|
|
15
|
+
* - Complete auth flow: Fetch workspaces + auto-select + issue token
|
|
16
|
+
*
|
|
17
|
+
* Uses the shell's Apollo client (via GatewayRoute) for useQuery, and
|
|
18
|
+
* graphqlFetch from fe-libs for imperative calls that need explicit tokens.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useMyWorkspaces(): {
|
|
21
|
+
workspaces: Workspace[];
|
|
22
|
+
totalWorkspaces: number;
|
|
23
|
+
currentWorkspaceId: string | null;
|
|
24
|
+
workspaceToken: string | null;
|
|
25
|
+
isLoading: boolean;
|
|
26
|
+
error: string | null;
|
|
27
|
+
fetchWorkspaces: (accessToken?: string) => Promise<Workspace[]>;
|
|
28
|
+
issueWorkspaceToken: (workspaceId: string, organizationId: string, accessToken?: string) => Promise<{
|
|
29
|
+
success: boolean;
|
|
30
|
+
token?: string;
|
|
31
|
+
error?: string;
|
|
32
|
+
}>;
|
|
33
|
+
selectWorkspace: (workspace: Workspace) => Promise<{
|
|
34
|
+
success: boolean;
|
|
35
|
+
error?: string;
|
|
36
|
+
}>;
|
|
37
|
+
completeAuthFlow: (accessToken?: string) => Promise<{
|
|
38
|
+
success: boolean;
|
|
39
|
+
workspace?: Workspace;
|
|
40
|
+
error?: string;
|
|
41
|
+
}>;
|
|
42
|
+
refetch: (variables?: Partial<import('@apollo/client').OperationVariables> | undefined) => Promise<{
|
|
43
|
+
data: MyWorkspacesResponse | undefined;
|
|
44
|
+
error?: import('@apollo/client').ErrorLike;
|
|
45
|
+
}>;
|
|
46
|
+
};
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AuthResult } from '../types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Supported OAuth providers
|
|
5
|
+
*/
|
|
6
|
+
export type OAuthProvider = "google" | "github" | "microsoft";
|
|
7
|
+
/**
|
|
8
|
+
* Hook for OAuth authentication operations
|
|
9
|
+
*/
|
|
10
|
+
export declare function useOAuthOperations(): {
|
|
11
|
+
initiateOAuth: (provider: OAuthProvider) => void;
|
|
12
|
+
completeOAuth: (code: string, state: string) => Promise<AuthResult>;
|
|
13
|
+
initiateGoogleOAuth: () => void;
|
|
14
|
+
initiateGitHubOAuth: () => void;
|
|
15
|
+
initiateMicrosoftOAuth: () => void;
|
|
16
|
+
isProviderConfigured: (provider: OAuthProvider) => boolean;
|
|
17
|
+
isLoading: boolean;
|
|
18
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ChangePasswordInput, PasswordResetRequestResult } from '../types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Hook for password management operations
|
|
5
|
+
* Uses Zustand v5 pattern: selectors for state, getState() for actions
|
|
6
|
+
*/
|
|
7
|
+
export declare function usePasswordOperations(): {
|
|
8
|
+
changePassword: (input: ChangePasswordInput) => Promise<boolean>;
|
|
9
|
+
requestPasswordReset: (email: string, recaptchaToken?: string) => Promise<PasswordResetRequestResult>;
|
|
10
|
+
resetPassword: (token: string, newPassword: string) => Promise<boolean>;
|
|
11
|
+
isLoading: boolean;
|
|
12
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ActiveSessionsQuery } from '../../generated/global-operations';
|
|
2
|
+
import { TokenValidationResponse, ValidateTokensInput } from '../types';
|
|
3
|
+
|
|
4
|
+
interface TokenInfoQueryResponse {
|
|
5
|
+
tokenInfo: TokenValidationResponse;
|
|
6
|
+
}
|
|
7
|
+
interface UseSessionOperationsOptions {
|
|
8
|
+
disableTokenInfoQuery?: boolean;
|
|
9
|
+
/** Number of sessions to load per page (default: 10) */
|
|
10
|
+
pageSize?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Hook for session/token management operations
|
|
14
|
+
*/
|
|
15
|
+
export declare function useSessionOperations(options?: UseSessionOperationsOptions): {
|
|
16
|
+
validateTokens: (input: ValidateTokensInput) => Promise<TokenValidationResponse>;
|
|
17
|
+
isTokenExpired: () => boolean;
|
|
18
|
+
getTokenRemainingTime: () => number;
|
|
19
|
+
tokenInfo: TokenValidationResponse | undefined;
|
|
20
|
+
revokeSession: (sessionId: string) => Promise<boolean>;
|
|
21
|
+
revokeAllSessions: () => Promise<{
|
|
22
|
+
success: boolean;
|
|
23
|
+
revokedCount: number;
|
|
24
|
+
}>;
|
|
25
|
+
activeSessions: {
|
|
26
|
+
__typename?: "Session";
|
|
27
|
+
id: string;
|
|
28
|
+
status: import('../../generated/global-types').SessionStatus;
|
|
29
|
+
ipAddress?: string | null;
|
|
30
|
+
userAgent?: string | null;
|
|
31
|
+
location?: string | null;
|
|
32
|
+
lastActivityAt: string;
|
|
33
|
+
expiresAt: string;
|
|
34
|
+
createdAt: string;
|
|
35
|
+
isCurrent: boolean;
|
|
36
|
+
}[];
|
|
37
|
+
sessionsLoading: boolean;
|
|
38
|
+
refetchSessions: (variables?: Partial<import('../../generated/global-types').Exact<{
|
|
39
|
+
pagination?: import('../../generated/global-types').InputMaybe<import('../../generated/global-types').PaginationInput>;
|
|
40
|
+
}>> | undefined) => Promise<{
|
|
41
|
+
data: ActiveSessionsQuery | undefined;
|
|
42
|
+
error?: import('@apollo/client').ErrorLike;
|
|
43
|
+
}>;
|
|
44
|
+
page: number;
|
|
45
|
+
pageSize: number;
|
|
46
|
+
totalCount: number;
|
|
47
|
+
totalPages: number;
|
|
48
|
+
hasMore: boolean;
|
|
49
|
+
goToNextPage: () => void;
|
|
50
|
+
goToPrevPage: () => void;
|
|
51
|
+
isLoading: boolean;
|
|
52
|
+
refetch: (variables?: Partial<import('@apollo/client').OperationVariables> | undefined) => Promise<{
|
|
53
|
+
data: TokenInfoQueryResponse | undefined;
|
|
54
|
+
error?: import('@apollo/client').ErrorLike;
|
|
55
|
+
}>;
|
|
56
|
+
};
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface SignupCaptchaState {
|
|
2
|
+
/** Whether the reCAPTCHA v2 checkbox should be rendered + required on signup. */
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
/** The reCAPTCHA v2 site key to render the widget with (undefined when disabled). */
|
|
5
|
+
siteKey: string | undefined;
|
|
6
|
+
/** True while the per-product config is still being fetched. */
|
|
7
|
+
loading: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Resolve whether the signup page should show the reCAPTCHA v2 checkbox, and
|
|
11
|
+
* with which site key, for the current host product.
|
|
12
|
+
*
|
|
13
|
+
* Source of truth is the platform product catalog: a product opts into signup
|
|
14
|
+
* captcha simply by having a `recaptchaSiteKey` configured (looked up here via
|
|
15
|
+
* the host-provided `productSlug`). This keeps enablement per-product and
|
|
16
|
+
* data-driven — no rebuild needed to turn it on/off for a product.
|
|
17
|
+
*
|
|
18
|
+
* Falls back to the build-time env (`VITE_CAPTCHA_ENABLED` +
|
|
19
|
+
* `VITE_RECAPTCHA_SITE_KEY`) only for local source-dev where no `productSlug`
|
|
20
|
+
* is provided, preserving the previous behavior.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useSignupCaptcha(): SignupCaptchaState;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { AuthResult, SSOConfig } from '../types';
|
|
2
|
+
|
|
3
|
+
interface GetSSOConfigResponse {
|
|
4
|
+
getSSOConfig: SSOConfig | null;
|
|
5
|
+
}
|
|
6
|
+
interface GetSSOConfigVariables {
|
|
7
|
+
tenantId: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SSOConfigInput {
|
|
10
|
+
entityId: string;
|
|
11
|
+
ssoUrl: string;
|
|
12
|
+
sloUrl?: string;
|
|
13
|
+
certificate: string;
|
|
14
|
+
enabled?: boolean;
|
|
15
|
+
metadata?: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
export interface SAMLRequestResult {
|
|
18
|
+
requestId: string;
|
|
19
|
+
ssoUrl: string;
|
|
20
|
+
samlRequest: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ExternalOIDCAuthUrlResult {
|
|
23
|
+
authUrl: string;
|
|
24
|
+
state: string;
|
|
25
|
+
nonce: string;
|
|
26
|
+
codeVerifier: string;
|
|
27
|
+
relayState?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface OIDCConfig {
|
|
30
|
+
issuer: string;
|
|
31
|
+
authorizationEndpoint: string;
|
|
32
|
+
tokenEndpoint: string;
|
|
33
|
+
userinfoEndpoint: string;
|
|
34
|
+
jwksUri: string;
|
|
35
|
+
registrationEndpoint?: string;
|
|
36
|
+
scopesSupported: string[];
|
|
37
|
+
responseTypesSupported: string[];
|
|
38
|
+
grantTypesSupported: string[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Hook for SSO/SAML operations
|
|
42
|
+
*/
|
|
43
|
+
export declare function useSsoOperations(tenantId?: string): {
|
|
44
|
+
initiateSsoLogin: (targetTenantId: string, relayState?: string) => Promise<void>;
|
|
45
|
+
handleSamlCallback: (samlResponse: string, relayState?: string) => Promise<AuthResult>;
|
|
46
|
+
saveSsoConfig: (configOrTenantId: SSOConfigInput | string, config?: SSOConfigInput) => Promise<SSOConfig>;
|
|
47
|
+
deleteSsoConfig: (targetTenantId?: string) => Promise<boolean>;
|
|
48
|
+
getOidcAuthUrl: (clientId: string, redirectUri: string, scopes?: string[]) => Promise<string>;
|
|
49
|
+
exchangeOidcCode: (code: string, clientId: string, redirectUri: string) => Promise<AuthResult>;
|
|
50
|
+
validateOidcState: (state: string) => boolean;
|
|
51
|
+
initiateExternalOidcLogin: (targetTenantId: string, redirectPath?: string) => Promise<void>;
|
|
52
|
+
handleExternalOidcCallback: (code: string, state: string) => Promise<AuthResult>;
|
|
53
|
+
isExternalOidcCallback: () => boolean;
|
|
54
|
+
ssoConfig: SSOConfig | undefined;
|
|
55
|
+
oidcConfig: OIDCConfig | undefined;
|
|
56
|
+
isLoading: boolean;
|
|
57
|
+
isGeneratingRequest: boolean;
|
|
58
|
+
isAuthenticating: boolean;
|
|
59
|
+
isSaving: boolean;
|
|
60
|
+
isDeleting: boolean;
|
|
61
|
+
isGeneratingOidcUrl: boolean;
|
|
62
|
+
refetchConfig: (variables?: Partial<GetSSOConfigVariables> | undefined) => Promise<{
|
|
63
|
+
data: GetSSOConfigResponse | undefined;
|
|
64
|
+
error?: import('@apollo/client').ErrorLike;
|
|
65
|
+
}>;
|
|
66
|
+
};
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Automatic workspace token refresh hook
|
|
3
|
+
*
|
|
4
|
+
* Monitors the workspace token and automatically refreshes it
|
|
5
|
+
* 5 minutes before expiry. This ensures uninterrupted access to
|
|
6
|
+
* workspace resources.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* ```tsx
|
|
10
|
+
* // In your root App component
|
|
11
|
+
* function App() {
|
|
12
|
+
* useTokenRefresh({
|
|
13
|
+
* workspaceAuthServiceUrl: 'http://localhost:3730/graphql',
|
|
14
|
+
* refreshBeforeExpiry: 5 * 60 * 1000, // 5 minutes
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* return <AppContent />;
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export interface UseTokenRefreshOptions {
|
|
22
|
+
/**
|
|
23
|
+
* URL of workspace auth service GraphQL endpoint
|
|
24
|
+
* Default: http://localhost:3730/graphql
|
|
25
|
+
*/
|
|
26
|
+
workspaceAuthServiceUrl?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Time before expiry to refresh token (in milliseconds)
|
|
29
|
+
* Default: 5 minutes (300000ms)
|
|
30
|
+
*/
|
|
31
|
+
refreshBeforeExpiry?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Enable/disable auto-refresh
|
|
34
|
+
* Default: true
|
|
35
|
+
*/
|
|
36
|
+
enabled?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Callback when token refresh succeeds
|
|
39
|
+
*/
|
|
40
|
+
onRefreshSuccess?: (token: string) => void;
|
|
41
|
+
/**
|
|
42
|
+
* Callback when token refresh fails
|
|
43
|
+
*/
|
|
44
|
+
onRefreshError?: (error: Error) => void;
|
|
45
|
+
}
|
|
46
|
+
export declare function useTokenRefresh(options?: UseTokenRefreshOptions): {
|
|
47
|
+
/**
|
|
48
|
+
* Manually trigger a token refresh
|
|
49
|
+
*/
|
|
50
|
+
manualRefresh: () => Promise<string>;
|
|
51
|
+
/**
|
|
52
|
+
* Check if auto-refresh is currently scheduled
|
|
53
|
+
*/
|
|
54
|
+
isScheduled: boolean;
|
|
55
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { User, UserConnection, UserFilterInput, PaginationInput, DeleteUserResult } from '../types';
|
|
2
|
+
|
|
3
|
+
interface UpdateUserProfileInput {
|
|
4
|
+
avatar?: string;
|
|
5
|
+
username?: string;
|
|
6
|
+
firstName?: string;
|
|
7
|
+
lastName?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
phoneNumber?: string;
|
|
10
|
+
defaultWorkspaceId?: string;
|
|
11
|
+
language?: string;
|
|
12
|
+
timezone?: string;
|
|
13
|
+
}
|
|
14
|
+
interface AdminUpdateUserInput extends UpdateUserProfileInput {
|
|
15
|
+
role?: string;
|
|
16
|
+
status?: string;
|
|
17
|
+
emailVerified?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Hook for user management operations
|
|
21
|
+
*/
|
|
22
|
+
export declare function useUserOperations(): {
|
|
23
|
+
getUser: (id: string) => Promise<User | null>;
|
|
24
|
+
listUsers: (filter?: UserFilterInput, pagination?: PaginationInput) => Promise<UserConnection>;
|
|
25
|
+
updateCurrentUserProfile: (input: UpdateUserProfileInput) => Promise<User>;
|
|
26
|
+
updateUser: (id: string, input: AdminUpdateUserInput) => Promise<User>;
|
|
27
|
+
deleteUser: (id: string) => Promise<DeleteUserResult>;
|
|
28
|
+
hardDeleteUser: (id: string) => Promise<DeleteUserResult>;
|
|
29
|
+
currentUser: User | null;
|
|
30
|
+
isLoading: boolean;
|
|
31
|
+
};
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useMutation } from '@apollo/client/react';
|
|
2
|
+
import { WorkspaceTokenResponse, SecretRotationResponse, RotateWorkspaceSecretInput } from '../types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Hook for workspace token and secret operations
|
|
6
|
+
*/
|
|
7
|
+
export declare function useWorkspaceOperations(): {
|
|
8
|
+
generateWorkspaceToken: (_workspaceId: string) => Promise<WorkspaceTokenResponse>;
|
|
9
|
+
switchWorkspace: (workspaceId: string) => Promise<WorkspaceTokenResponse>;
|
|
10
|
+
createWorkspaceSecret: (_workspaceId: string) => Promise<boolean>;
|
|
11
|
+
rotateWorkspaceSecret: (_input: RotateWorkspaceSecretInput) => Promise<SecretRotationResponse>;
|
|
12
|
+
revokeWorkspaceSecret: (_workspaceId: string) => Promise<boolean>;
|
|
13
|
+
revokeWorkspaceToken: (_token: string, _reason?: string) => Promise<boolean>;
|
|
14
|
+
revokeAllMyWorkspaceTokens: (_reason?: string) => Promise<number>;
|
|
15
|
+
clearWorkspace: () => void;
|
|
16
|
+
createWorkspaceMutation: useMutation.MutationFunction<unknown, {
|
|
17
|
+
[x: string]: any;
|
|
18
|
+
}, import('@apollo/client').ApolloCache, undefined>;
|
|
19
|
+
updateWorkspaceMutation: useMutation.MutationFunction<unknown, {
|
|
20
|
+
[x: string]: any;
|
|
21
|
+
}, import('@apollo/client').ApolloCache, undefined>;
|
|
22
|
+
addWorkspaceMemberMutation: useMutation.MutationFunction<unknown, {
|
|
23
|
+
[x: string]: any;
|
|
24
|
+
}, import('@apollo/client').ApolloCache, undefined>;
|
|
25
|
+
updateWorkspaceMemberMutation: useMutation.MutationFunction<unknown, {
|
|
26
|
+
[x: string]: any;
|
|
27
|
+
}, import('@apollo/client').ApolloCache, undefined>;
|
|
28
|
+
removeWorkspaceMemberMutation: useMutation.MutationFunction<unknown, {
|
|
29
|
+
[x: string]: any;
|
|
30
|
+
}, import('@apollo/client').ApolloCache, undefined>;
|
|
31
|
+
currentWorkspaceId: string | null;
|
|
32
|
+
workspaceToken: string | null;
|
|
33
|
+
isLoading: boolean;
|
|
34
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace token management hook
|
|
3
|
+
*
|
|
4
|
+
* Provides functions to issue, refresh, and verify workspace tokens.
|
|
5
|
+
* Automatically updates the auth store with new tokens.
|
|
6
|
+
*
|
|
7
|
+
* API Flow:
|
|
8
|
+
* - Calls workspace gateway (https://gw-wspace.local.burdenoff.com/workspaces/graphql)
|
|
9
|
+
* - Gateway federates wspace-auth-svc which handles token operations
|
|
10
|
+
* - Auth token (from global-auth-svc) goes in Authorization header
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* ```tsx
|
|
14
|
+
* const { issueToken, refreshToken, verifyToken, isLoading, error } = useWorkspaceToken({
|
|
15
|
+
* workspaceGatewayUrl: 'https://gw-wspace.local.burdenoff.com/workspaces/graphql'
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* // After login and organization/workspace selection
|
|
19
|
+
* await issueToken(organizationId, workspaceId);
|
|
20
|
+
*
|
|
21
|
+
* // Refresh token before expiry (uses stored org/workspace IDs)
|
|
22
|
+
* await refreshToken();
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export interface UseWorkspaceTokenOptions {
|
|
26
|
+
/**
|
|
27
|
+
* URL of workspace gateway GraphQL endpoint
|
|
28
|
+
* Default: https://gw-wspace.local.burdenoff.com/workspaces/graphql
|
|
29
|
+
*
|
|
30
|
+
* Note: This should point to the workspace gateway, NOT directly to wspace-auth-svc.
|
|
31
|
+
* The gateway federates wspace-auth-svc and handles routing.
|
|
32
|
+
*/
|
|
33
|
+
workspaceGatewayUrl?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface WorkspaceTokenPayload {
|
|
36
|
+
sub: string;
|
|
37
|
+
workspaceId: string;
|
|
38
|
+
tenantId?: string;
|
|
39
|
+
email?: string;
|
|
40
|
+
username?: string;
|
|
41
|
+
role?: string;
|
|
42
|
+
scopes: string[];
|
|
43
|
+
iat: number;
|
|
44
|
+
exp: number;
|
|
45
|
+
}
|
|
46
|
+
export declare function useWorkspaceToken(_options?: UseWorkspaceTokenOptions): {
|
|
47
|
+
issueToken: (organizationId: string, workspaceId?: string, projectId?: string, scopes?: string[]) => Promise<string>;
|
|
48
|
+
refreshToken: () => Promise<string>;
|
|
49
|
+
verifyToken: (token?: string) => Promise<WorkspaceTokenPayload>;
|
|
50
|
+
decodeToken: (token: string) => WorkspaceTokenPayload;
|
|
51
|
+
isTokenExpired: (token?: string) => boolean;
|
|
52
|
+
getTimeUntilExpiry: (token?: string) => number;
|
|
53
|
+
isLoading: boolean;
|
|
54
|
+
error: string | null;
|
|
55
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth Microfrontend
|
|
3
|
+
*
|
|
4
|
+
* Provides authentication, security settings, and account management interface
|
|
5
|
+
* for the Burdenoff multi-tenant platform.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - User authentication (signIn, signUp, signOut, refreshToken)
|
|
9
|
+
* - MFA (TOTP, SMS, Email, WebAuthn)
|
|
10
|
+
* - OAuth and SAML SSO
|
|
11
|
+
* - Magic Link authentication
|
|
12
|
+
* - Workspace token management
|
|
13
|
+
* - User management (admin)
|
|
14
|
+
*
|
|
15
|
+
* Note: API Key management, App management, and App-user delegations
|
|
16
|
+
* have been consolidated into microfe-devportal.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* import { AuthRoot, type AuthRootProps } from '@burdenoff/microfe-auth';
|
|
21
|
+
*
|
|
22
|
+
* function App() {
|
|
23
|
+
* const props: AuthRootProps = {
|
|
24
|
+
* basePath: '/auth',
|
|
25
|
+
* navigate: (path) => router.push(path),
|
|
26
|
+
* apiGatewayUrl: 'https://gw-global.local.burdenoff.com',
|
|
27
|
+
* authToken: 'token',
|
|
28
|
+
* onAuthSuccess: (user) => shellLogin(user),
|
|
29
|
+
* onLogout: () => shellLogout(),
|
|
30
|
+
* };
|
|
31
|
+
*
|
|
32
|
+
* return <AuthRoot {...props} />;
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export { AuthRoot } from './AuthRoot';
|
|
37
|
+
export type { AuthRootProps, User, UserRole, UserStatus, UserConnection, UserFilterInput, PaginationInput, } from './types';
|
|
38
|
+
export type { AuthType, AuthMethod, AuthMethodConfig, AuthStrategyHealth, AuthPayload, AuthResult, SignInInput, SignUpInput, ChangePasswordInput, } from './types';
|
|
39
|
+
export type { MFAMethod, MFASetupResult, MFAVerifyInput } from './types';
|
|
40
|
+
export type { OAuthInput, SAMLInput, SAMLRequestResult } from './types';
|
|
41
|
+
export type { AuthContext, MagicLinkSendResult } from './types';
|
|
42
|
+
export type { Organization, OrganizationConnection } from './types';
|
|
43
|
+
export type { Project, ProjectStatus, ProjectConnection } from './types';
|
|
44
|
+
export type { Workspace, WorkspaceSecretStatus, WorkspaceSecretInfo, WorkspaceTokenResponse, GenerateWorkspaceTokenInput, RotateWorkspaceSecretInput, SecretRotationResponse, } from './types';
|
|
45
|
+
export type { TokenValidationError, TokenValidationResponse, ValidateTokensInput, } from './types';
|
|
46
|
+
export type { EmailVerificationResult, ResendVerificationResult, PasswordResetRequestResult, DeleteUserResult, } from './types';
|
|
47
|
+
export type { Session, MfaDevice, OAuthAccount, SecurityAudit, OAuthProvider, SecurityEventType, TrustedDevice, SSOConfig, PasswordStrength, } from './types';
|
|
48
|
+
export { useAuth } from './providers/AuthProvider';
|
|
49
|
+
export { useAuthOperations, useMfaOperations, useSessionOperations, usePasswordOperations, useAuthStore, } from './hooks';
|
|
50
|
+
export { useWorkspaceOperations } from './hooks';
|
|
51
|
+
export { useUserOperations } from './hooks';
|
|
52
|
+
export { useWorkspaceToken } from './hooks/useWorkspaceToken';
|
|
53
|
+
export { useTokenRefresh } from './hooks/useTokenRefresh';
|
|
54
|
+
export { useContextSwitcherData, useWorkspaceSyncEffect, useProjectSyncEffect, useActiveContextBootstrapMirror, } from './hooks';
|
|
55
|
+
export { useMyWorkspaces } from './hooks';
|
|
56
|
+
export type { UseContextSwitcherDataOptions } from './hooks';
|
|
57
|
+
export type { ActiveContextBootstrapMirrorArgs } from './hooks';
|
|
58
|
+
export { WorkspaceSelector } from './components/workspace/WorkspaceSelector';
|
|
59
|
+
export type { WorkspaceSelectorProps } from './components/workspace/WorkspaceSelector';
|
|
60
|
+
export { UserProfileMenu } from './components/profile/UserProfileMenu';
|
|
61
|
+
export type { UserProfileMenuProps } from './components/profile/UserProfileMenu';
|
|
62
|
+
export { SSORelayPage } from './pages/SSORelayPage';
|
|
63
|
+
export { SSORelayCallbackPage } from './pages/SSORelayCallbackPage';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Security audit log page with pagination and export
|
|
3
|
+
*
|
|
4
|
+
* Fragment: AuditLogEntry_AuthAuditLog (graphql/operations/global/fragments/AuditLogEntry.fragment.graphql)
|
|
5
|
+
* Query: AuthAuditLogs (graphql/operations/global/queries/auditLog.graphql)
|
|
6
|
+
*
|
|
7
|
+
* TODO: When authAuditLogs backend migrates to AuthAuditLogConnection type,
|
|
8
|
+
* update this query to use: authAuditLogs { auditLogs: [...], totalCount, hasMore }
|
|
9
|
+
* and remove the client-side hasMore approximation below.
|
|
10
|
+
*/
|
|
11
|
+
export declare function AuditLogPage(): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSOClearPage — Cross-Domain Logout at the Central Bridge Host
|
|
3
|
+
*
|
|
4
|
+
* Companion to SSODepositPage. When a user signs out on a product origin,
|
|
5
|
+
* the product app cleared its own localStorage / cookies but the bridge
|
|
6
|
+
* host (alphaapp/app.burdenoff.com) still held the deposited session in
|
|
7
|
+
* first-party (unpartitioned) localStorage. A later visit to any product
|
|
8
|
+
* would then bridge-host-relay that stale session back, effectively
|
|
9
|
+
* undoing the logout.
|
|
10
|
+
*
|
|
11
|
+
* AuthProvider.logout() / logoutAll() on a non-bridge-host origin redirect
|
|
12
|
+
* here via a top-level navigation:
|
|
13
|
+
*
|
|
14
|
+
* product.com (logout)
|
|
15
|
+
* → app.burdenoff.com/auth/sso-clear?returnTo=<encoded-return-url>
|
|
16
|
+
* — wipes bridge-host localStorage + bf-sso cookie
|
|
17
|
+
* → <returnTo>
|
|
18
|
+
*
|
|
19
|
+
* URL: /auth/sso-clear
|
|
20
|
+
*/
|
|
21
|
+
export declare function SSOClearPage(): import("react").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSODepositPage — Cross-Domain Token Deposit at the Central Bridge Host
|
|
3
|
+
*
|
|
4
|
+
* Loaded as a top-level navigation (NOT an iframe) on the bridge host
|
|
5
|
+
* (alphaapp/app.burdenoff.com) right after a user signs in on any other
|
|
6
|
+
* product origin. It receives the freshly-issued tokens in the URL fragment
|
|
7
|
+
* (`#sso=<base64>` — fragments are never sent to servers) and stores them
|
|
8
|
+
* in this origin's first-party (unpartitioned) localStorage so that:
|
|
9
|
+
*
|
|
10
|
+
* 1. A later top-level visit to the bridge host renders authenticated.
|
|
11
|
+
* 2. Other product origins can discover the session via
|
|
12
|
+
* `/auth/sso-relay?returnTo=...` against this host.
|
|
13
|
+
*
|
|
14
|
+
* Flow:
|
|
15
|
+
* product.com/auth/login → user signs in
|
|
16
|
+
* product.com → POST-success redirect to:
|
|
17
|
+
* app.burdenoff.com/auth/sso-deposit?returnTo=<encoded-return-url>#sso=<base64>
|
|
18
|
+
* → writes tokens here, sets bf-sso cookie
|
|
19
|
+
* <returnTo> → user lands back at intended dashboard
|
|
20
|
+
*
|
|
21
|
+
* URL: /auth/sso-deposit
|
|
22
|
+
*/
|
|
23
|
+
export declare function SSODepositPage(): import("react").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSORelayCallbackPage — Receives tokens from the SSO relay and stores them locally.
|
|
3
|
+
*
|
|
4
|
+
* Tokens arrive in the URL fragment (#sso=<base64>) which is never sent to servers.
|
|
5
|
+
* After storing in localStorage, redirects to the returnTo path.
|
|
6
|
+
*/
|
|
7
|
+
export declare function SSORelayCallbackPage(): import("react").JSX.Element;
|