@oauth42/next 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +57 -0
- package/README.md +226 -0
- package/dist/client/index.d.mts +111 -0
- package/dist/client/index.d.ts +111 -0
- package/dist/client/index.js +234 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/index.mjs +197 -0
- package/dist/client/index.mjs.map +1 -0
- package/dist/index-xJCMwWtK.d.mts +122 -0
- package/dist/index-xJCMwWtK.d.ts +122 -0
- package/dist/index.d.mts +44 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +305 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +260 -0
- package/dist/index.mjs.map +1 -0
- package/dist/server/index.d.mts +5 -0
- package/dist/server/index.d.ts +5 -0
- package/dist/server/index.js +316 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/index.mjs +269 -0
- package/dist/server/index.mjs.map +1 -0
- package/package.json +79 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
OAuth42 SDK License Agreement
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 OAuth42, Inc. All rights reserved.
|
|
4
|
+
|
|
5
|
+
IMPORTANT: READ CAREFULLY
|
|
6
|
+
|
|
7
|
+
This OAuth42 Software Development Kit (SDK) License Agreement ("Agreement") is a legal
|
|
8
|
+
agreement between you (either an individual or a single entity) and OAuth42, Inc.
|
|
9
|
+
("OAuth42") for the OAuth42 SDK software, which includes computer software and may
|
|
10
|
+
include associated media, printed materials, and "online" or electronic documentation
|
|
11
|
+
("SDK").
|
|
12
|
+
|
|
13
|
+
BY DOWNLOADING, INSTALLING, COPYING, OR OTHERWISE USING THE SDK, YOU AGREE TO BE BOUND
|
|
14
|
+
BY THE TERMS OF THIS AGREEMENT.
|
|
15
|
+
|
|
16
|
+
1. GRANT OF LICENSE
|
|
17
|
+
OAuth42 grants you a limited, non-exclusive, non-transferable, revocable license to:
|
|
18
|
+
a) Use the SDK solely to develop applications that interact with OAuth42 services
|
|
19
|
+
b) Distribute the SDK as part of your application that connects to OAuth42 services
|
|
20
|
+
c) Modify the SDK for your internal use with OAuth42 services
|
|
21
|
+
|
|
22
|
+
2. RESTRICTIONS
|
|
23
|
+
You may NOT:
|
|
24
|
+
a) Use the SDK to create competing authentication or identity services
|
|
25
|
+
b) Remove or alter any proprietary notices or labels on the SDK
|
|
26
|
+
c) Reverse engineer, decompile, or disassemble the SDK, except to the extent that
|
|
27
|
+
applicable law expressly permits such activity
|
|
28
|
+
d) Use the SDK in any way that violates applicable laws or regulations
|
|
29
|
+
|
|
30
|
+
3. OWNERSHIP
|
|
31
|
+
The SDK is licensed, not sold. OAuth42 retains all right, title, and interest in
|
|
32
|
+
and to the SDK, including all intellectual property rights.
|
|
33
|
+
|
|
34
|
+
4. NO WARRANTY
|
|
35
|
+
THE SDK IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
36
|
+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
37
|
+
PARTICULAR PURPOSE, AND NONINFRINGEMENT.
|
|
38
|
+
|
|
39
|
+
5. LIMITATION OF LIABILITY
|
|
40
|
+
IN NO EVENT SHALL OAUTH42 BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR
|
|
41
|
+
CONSEQUENTIAL DAMAGES WHATSOEVER ARISING OUT OF THE USE OF OR INABILITY TO USE
|
|
42
|
+
THE SDK.
|
|
43
|
+
|
|
44
|
+
6. TERMINATION
|
|
45
|
+
This Agreement is effective until terminated. OAuth42 may terminate this Agreement
|
|
46
|
+
at any time if you fail to comply with any term of this Agreement. Upon termination,
|
|
47
|
+
you must destroy all copies of the SDK.
|
|
48
|
+
|
|
49
|
+
7. GOVERNING LAW
|
|
50
|
+
This Agreement shall be governed by the laws of the State of Delaware, USA, without
|
|
51
|
+
regard to its conflict of law provisions.
|
|
52
|
+
|
|
53
|
+
8. ENTIRE AGREEMENT
|
|
54
|
+
This Agreement constitutes the entire agreement between you and OAuth42 relating to
|
|
55
|
+
the SDK and supersedes all prior or contemporaneous understandings.
|
|
56
|
+
|
|
57
|
+
For questions about this license, please contact: legal@oauth42.com
|
package/README.md
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# @oauth42/next
|
|
2
|
+
|
|
3
|
+
Official OAuth42 SDK for Next.js applications. Provides seamless integration with NextAuth.js for authentication.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @oauth42/next
|
|
9
|
+
# or
|
|
10
|
+
yarn add @oauth42/next
|
|
11
|
+
# or
|
|
12
|
+
pnpm add @oauth42/next
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
### 1. Environment Variables
|
|
18
|
+
|
|
19
|
+
Add these to your `.env.local`:
|
|
20
|
+
|
|
21
|
+
```env
|
|
22
|
+
OAUTH42_CLIENT_ID=your-client-id
|
|
23
|
+
OAUTH42_CLIENT_SECRET=your-client-secret
|
|
24
|
+
OAUTH42_ISSUER=https://oauth42.com
|
|
25
|
+
NEXTAUTH_URL=http://localhost:3000
|
|
26
|
+
NEXTAUTH_SECRET=your-nextauth-secret
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 2. Setup Authentication
|
|
30
|
+
|
|
31
|
+
Create `app/api/auth/[...nextauth]/route.ts` (App Router) or `pages/api/auth/[...nextauth].ts` (Pages Router):
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import { createAuth } from '@oauth42/next';
|
|
35
|
+
|
|
36
|
+
export const { handlers, auth } = createAuth({
|
|
37
|
+
// Optional: Override defaults
|
|
38
|
+
scopes: ['openid', 'profile', 'email'],
|
|
39
|
+
pkceEnabled: true,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// App Router
|
|
43
|
+
export const { GET, POST } = handlers;
|
|
44
|
+
|
|
45
|
+
// Pages Router
|
|
46
|
+
export default handlers;
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 3. Add Session Provider
|
|
50
|
+
|
|
51
|
+
Wrap your app with the SessionProvider:
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
// app/layout.tsx or pages/_app.tsx
|
|
55
|
+
import { SessionProvider } from 'next-auth/react';
|
|
56
|
+
|
|
57
|
+
export default function RootLayout({ children }) {
|
|
58
|
+
return (
|
|
59
|
+
<html>
|
|
60
|
+
<body>
|
|
61
|
+
<SessionProvider>{children}</SessionProvider>
|
|
62
|
+
</body>
|
|
63
|
+
</html>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 4. Use in Components
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import { useOAuth42Session, SignInButton, SignOutButton } from '@oauth42/next/client';
|
|
72
|
+
|
|
73
|
+
export function MyComponent() {
|
|
74
|
+
const { session, isAuthenticated, loading } = useOAuth42Session();
|
|
75
|
+
|
|
76
|
+
if (loading) return <div>Loading...</div>;
|
|
77
|
+
|
|
78
|
+
if (!isAuthenticated) {
|
|
79
|
+
return <SignInButton />;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<div>
|
|
84
|
+
<p>Welcome, {session?.user?.email}!</p>
|
|
85
|
+
<SignOutButton />
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Advanced Usage
|
|
92
|
+
|
|
93
|
+
### Custom Provider Configuration
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
import { OAuth42Provider } from '@oauth42/next';
|
|
97
|
+
import NextAuth from 'next-auth';
|
|
98
|
+
|
|
99
|
+
export default NextAuth({
|
|
100
|
+
providers: [
|
|
101
|
+
OAuth42Provider({
|
|
102
|
+
clientId: process.env.OAUTH42_CLIENT_ID,
|
|
103
|
+
clientSecret: process.env.OAUTH42_CLIENT_SECRET,
|
|
104
|
+
issuer: 'https://custom.oauth42.com',
|
|
105
|
+
scopes: ['custom', 'scopes'],
|
|
106
|
+
}),
|
|
107
|
+
],
|
|
108
|
+
});
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Middleware Protection
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
// middleware.ts
|
|
115
|
+
import { withOAuth42Auth } from '@oauth42/next/server';
|
|
116
|
+
|
|
117
|
+
export default withOAuth42Auth({
|
|
118
|
+
pages: {
|
|
119
|
+
signIn: '/login',
|
|
120
|
+
},
|
|
121
|
+
callbacks: {
|
|
122
|
+
authorized: ({ token }) => !!token,
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
export const config = {
|
|
127
|
+
matcher: ['/protected/:path*'],
|
|
128
|
+
};
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Server-Side Session
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
// App Router - Recommended approach
|
|
135
|
+
import { getOAuth42Session } from '@oauth42/next/server';
|
|
136
|
+
import { authOptions } from '@/lib/auth';
|
|
137
|
+
|
|
138
|
+
export default async function Page() {
|
|
139
|
+
const session = await getOAuth42Session(authOptions);
|
|
140
|
+
|
|
141
|
+
if (!session) {
|
|
142
|
+
return <div>Not authenticated</div>;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return <div>Welcome {session.user?.email}</div>;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Pages Router
|
|
149
|
+
import { getOAuth42Session } from '@oauth42/next/server';
|
|
150
|
+
import { authOptions } from '@/lib/auth';
|
|
151
|
+
|
|
152
|
+
export async function getServerSideProps(context) {
|
|
153
|
+
const session = await getOAuth42Session(
|
|
154
|
+
context.req,
|
|
155
|
+
context.res,
|
|
156
|
+
authOptions
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
if (!session) {
|
|
160
|
+
return {
|
|
161
|
+
redirect: {
|
|
162
|
+
destination: '/auth/signin',
|
|
163
|
+
permanent: false,
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return {
|
|
169
|
+
props: { session },
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Note: `getServerSession` is also available for backward compatibility but `getOAuth42Session` is the recommended method.
|
|
175
|
+
|
|
176
|
+
### API Route Protection
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
import { withOAuth42Session } from '@oauth42/next/server';
|
|
180
|
+
import { auth } from '@/app/api/auth/[...nextauth]/route';
|
|
181
|
+
|
|
182
|
+
export default withOAuth42Session(
|
|
183
|
+
async (req, res, session) => {
|
|
184
|
+
res.json({ user: session.user });
|
|
185
|
+
},
|
|
186
|
+
auth
|
|
187
|
+
);
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Hooks
|
|
191
|
+
|
|
192
|
+
### useOAuth42Session
|
|
193
|
+
Get the current session and authentication state.
|
|
194
|
+
|
|
195
|
+
### useOAuth42User
|
|
196
|
+
Get the current user information.
|
|
197
|
+
|
|
198
|
+
### useOAuth42Tokens
|
|
199
|
+
Access and manage OAuth2 tokens.
|
|
200
|
+
|
|
201
|
+
### useRequireAuth
|
|
202
|
+
Protect routes and redirect unauthenticated users.
|
|
203
|
+
|
|
204
|
+
## Components
|
|
205
|
+
|
|
206
|
+
### SignInButton
|
|
207
|
+
Customizable sign-in button.
|
|
208
|
+
|
|
209
|
+
### SignOutButton
|
|
210
|
+
Customizable sign-out button.
|
|
211
|
+
|
|
212
|
+
### UserProfile
|
|
213
|
+
Display user profile information.
|
|
214
|
+
|
|
215
|
+
### AuthStatus
|
|
216
|
+
Conditional rendering based on auth state.
|
|
217
|
+
|
|
218
|
+
### ProtectedComponent
|
|
219
|
+
Wrapper for protected content.
|
|
220
|
+
|
|
221
|
+
## License
|
|
222
|
+
|
|
223
|
+
Copyright (c) 2024 OAuth42, Inc. All rights reserved.
|
|
224
|
+
|
|
225
|
+
This SDK is proprietary software provided by OAuth42, Inc. for use with OAuth42 services.
|
|
226
|
+
See LICENSE file for terms and conditions.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
export { SessionProvider, signIn, signOut, useSession } from 'next-auth/react';
|
|
2
|
+
export { Session } from 'next-auth';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
type OAuth42Session<E = {}> = ({
|
|
7
|
+
user?: {
|
|
8
|
+
email?: string | null;
|
|
9
|
+
name?: string | null;
|
|
10
|
+
image?: string | null;
|
|
11
|
+
username?: string;
|
|
12
|
+
emailVerified?: boolean;
|
|
13
|
+
};
|
|
14
|
+
accessToken?: string;
|
|
15
|
+
idToken?: string;
|
|
16
|
+
expires?: string;
|
|
17
|
+
}) & E;
|
|
18
|
+
interface UseOAuth42SessionReturn<E = {}> {
|
|
19
|
+
session: OAuth42Session<E> | null;
|
|
20
|
+
loading: boolean;
|
|
21
|
+
error: Error | null;
|
|
22
|
+
isAuthenticated: boolean;
|
|
23
|
+
signIn: () => Promise<void>;
|
|
24
|
+
signOut: () => Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Hook to manage OAuth42 session with optional extra fields
|
|
28
|
+
*/
|
|
29
|
+
declare function useOAuth42Session<E = {}>(): UseOAuth42SessionReturn<E>;
|
|
30
|
+
/**
|
|
31
|
+
* Hook to get the current OAuth42 user
|
|
32
|
+
*/
|
|
33
|
+
declare function useOAuth42User<E = {}>(): {
|
|
34
|
+
user: {
|
|
35
|
+
email?: string | null;
|
|
36
|
+
name?: string | null;
|
|
37
|
+
image?: string | null;
|
|
38
|
+
username?: string;
|
|
39
|
+
emailVerified?: boolean;
|
|
40
|
+
} | null | undefined;
|
|
41
|
+
isAuthenticated: boolean;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Hook to manage OAuth42 tokens
|
|
45
|
+
*/
|
|
46
|
+
declare function useOAuth42Tokens<E = {}>(): {
|
|
47
|
+
accessToken: string | undefined;
|
|
48
|
+
idToken: string | undefined;
|
|
49
|
+
isExpired: boolean;
|
|
50
|
+
refreshToken: () => Promise<void>;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Hook for protected routes
|
|
54
|
+
*/
|
|
55
|
+
declare function useRequireAuth(redirectTo?: string): {
|
|
56
|
+
isAuthenticated: boolean;
|
|
57
|
+
loading: boolean;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
interface SignInButtonProps {
|
|
61
|
+
children?: React.ReactNode;
|
|
62
|
+
className?: string;
|
|
63
|
+
callbackUrl?: string;
|
|
64
|
+
onClick?: () => void;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Sign in button component
|
|
68
|
+
*/
|
|
69
|
+
declare function SignInButton({ children, className, callbackUrl, onClick }: SignInButtonProps): react_jsx_runtime.JSX.Element;
|
|
70
|
+
interface SignOutButtonProps {
|
|
71
|
+
children?: React.ReactNode;
|
|
72
|
+
className?: string;
|
|
73
|
+
callbackUrl?: string;
|
|
74
|
+
onClick?: () => void;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Sign out button component
|
|
78
|
+
*/
|
|
79
|
+
declare function SignOutButton({ children, className, callbackUrl, onClick }: SignOutButtonProps): react_jsx_runtime.JSX.Element;
|
|
80
|
+
interface UserProfileProps {
|
|
81
|
+
className?: string;
|
|
82
|
+
showEmail?: boolean;
|
|
83
|
+
showName?: boolean;
|
|
84
|
+
showImage?: boolean;
|
|
85
|
+
loadingComponent?: React.ReactNode;
|
|
86
|
+
notAuthenticatedComponent?: React.ReactNode;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* User profile display component
|
|
90
|
+
*/
|
|
91
|
+
declare function UserProfile({ className, showEmail, showName, showImage, loadingComponent, notAuthenticatedComponent, }: UserProfileProps): react_jsx_runtime.JSX.Element;
|
|
92
|
+
interface AuthStatusProps {
|
|
93
|
+
authenticatedComponent?: React.ReactNode;
|
|
94
|
+
unauthenticatedComponent?: React.ReactNode;
|
|
95
|
+
loadingComponent?: React.ReactNode;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Conditional rendering based on auth status
|
|
99
|
+
*/
|
|
100
|
+
declare function AuthStatus({ authenticatedComponent, unauthenticatedComponent, loadingComponent, }: AuthStatusProps): react_jsx_runtime.JSX.Element;
|
|
101
|
+
interface ProtectedComponentProps {
|
|
102
|
+
children: React.ReactNode;
|
|
103
|
+
fallback?: React.ReactNode;
|
|
104
|
+
loadingComponent?: React.ReactNode;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Wrapper component for protected content
|
|
108
|
+
*/
|
|
109
|
+
declare function ProtectedComponent({ children, fallback, loadingComponent, }: ProtectedComponentProps): react_jsx_runtime.JSX.Element;
|
|
110
|
+
|
|
111
|
+
export { AuthStatus, type AuthStatusProps, type OAuth42Session, ProtectedComponent, type ProtectedComponentProps, SignInButton, type SignInButtonProps, SignOutButton, type SignOutButtonProps, type UseOAuth42SessionReturn, UserProfile, type UserProfileProps, useOAuth42Session, useOAuth42Tokens, useOAuth42User, useRequireAuth };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
export { SessionProvider, signIn, signOut, useSession } from 'next-auth/react';
|
|
2
|
+
export { Session } from 'next-auth';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
type OAuth42Session<E = {}> = ({
|
|
7
|
+
user?: {
|
|
8
|
+
email?: string | null;
|
|
9
|
+
name?: string | null;
|
|
10
|
+
image?: string | null;
|
|
11
|
+
username?: string;
|
|
12
|
+
emailVerified?: boolean;
|
|
13
|
+
};
|
|
14
|
+
accessToken?: string;
|
|
15
|
+
idToken?: string;
|
|
16
|
+
expires?: string;
|
|
17
|
+
}) & E;
|
|
18
|
+
interface UseOAuth42SessionReturn<E = {}> {
|
|
19
|
+
session: OAuth42Session<E> | null;
|
|
20
|
+
loading: boolean;
|
|
21
|
+
error: Error | null;
|
|
22
|
+
isAuthenticated: boolean;
|
|
23
|
+
signIn: () => Promise<void>;
|
|
24
|
+
signOut: () => Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Hook to manage OAuth42 session with optional extra fields
|
|
28
|
+
*/
|
|
29
|
+
declare function useOAuth42Session<E = {}>(): UseOAuth42SessionReturn<E>;
|
|
30
|
+
/**
|
|
31
|
+
* Hook to get the current OAuth42 user
|
|
32
|
+
*/
|
|
33
|
+
declare function useOAuth42User<E = {}>(): {
|
|
34
|
+
user: {
|
|
35
|
+
email?: string | null;
|
|
36
|
+
name?: string | null;
|
|
37
|
+
image?: string | null;
|
|
38
|
+
username?: string;
|
|
39
|
+
emailVerified?: boolean;
|
|
40
|
+
} | null | undefined;
|
|
41
|
+
isAuthenticated: boolean;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Hook to manage OAuth42 tokens
|
|
45
|
+
*/
|
|
46
|
+
declare function useOAuth42Tokens<E = {}>(): {
|
|
47
|
+
accessToken: string | undefined;
|
|
48
|
+
idToken: string | undefined;
|
|
49
|
+
isExpired: boolean;
|
|
50
|
+
refreshToken: () => Promise<void>;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Hook for protected routes
|
|
54
|
+
*/
|
|
55
|
+
declare function useRequireAuth(redirectTo?: string): {
|
|
56
|
+
isAuthenticated: boolean;
|
|
57
|
+
loading: boolean;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
interface SignInButtonProps {
|
|
61
|
+
children?: React.ReactNode;
|
|
62
|
+
className?: string;
|
|
63
|
+
callbackUrl?: string;
|
|
64
|
+
onClick?: () => void;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Sign in button component
|
|
68
|
+
*/
|
|
69
|
+
declare function SignInButton({ children, className, callbackUrl, onClick }: SignInButtonProps): react_jsx_runtime.JSX.Element;
|
|
70
|
+
interface SignOutButtonProps {
|
|
71
|
+
children?: React.ReactNode;
|
|
72
|
+
className?: string;
|
|
73
|
+
callbackUrl?: string;
|
|
74
|
+
onClick?: () => void;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Sign out button component
|
|
78
|
+
*/
|
|
79
|
+
declare function SignOutButton({ children, className, callbackUrl, onClick }: SignOutButtonProps): react_jsx_runtime.JSX.Element;
|
|
80
|
+
interface UserProfileProps {
|
|
81
|
+
className?: string;
|
|
82
|
+
showEmail?: boolean;
|
|
83
|
+
showName?: boolean;
|
|
84
|
+
showImage?: boolean;
|
|
85
|
+
loadingComponent?: React.ReactNode;
|
|
86
|
+
notAuthenticatedComponent?: React.ReactNode;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* User profile display component
|
|
90
|
+
*/
|
|
91
|
+
declare function UserProfile({ className, showEmail, showName, showImage, loadingComponent, notAuthenticatedComponent, }: UserProfileProps): react_jsx_runtime.JSX.Element;
|
|
92
|
+
interface AuthStatusProps {
|
|
93
|
+
authenticatedComponent?: React.ReactNode;
|
|
94
|
+
unauthenticatedComponent?: React.ReactNode;
|
|
95
|
+
loadingComponent?: React.ReactNode;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Conditional rendering based on auth status
|
|
99
|
+
*/
|
|
100
|
+
declare function AuthStatus({ authenticatedComponent, unauthenticatedComponent, loadingComponent, }: AuthStatusProps): react_jsx_runtime.JSX.Element;
|
|
101
|
+
interface ProtectedComponentProps {
|
|
102
|
+
children: React.ReactNode;
|
|
103
|
+
fallback?: React.ReactNode;
|
|
104
|
+
loadingComponent?: React.ReactNode;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Wrapper component for protected content
|
|
108
|
+
*/
|
|
109
|
+
declare function ProtectedComponent({ children, fallback, loadingComponent, }: ProtectedComponentProps): react_jsx_runtime.JSX.Element;
|
|
110
|
+
|
|
111
|
+
export { AuthStatus, type AuthStatusProps, type OAuth42Session, ProtectedComponent, type ProtectedComponentProps, SignInButton, type SignInButtonProps, SignOutButton, type SignOutButtonProps, type UseOAuth42SessionReturn, UserProfile, type UserProfileProps, useOAuth42Session, useOAuth42Tokens, useOAuth42User, useRequireAuth };
|