-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(refactor): ✨ Deprecated requireUserSession; Internal refactoring
- Loading branch information
Showing
14 changed files
with
34 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ declare module '#oidc-auth' { | |
} | ||
} | ||
|
||
export {} | ||
export {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import { eventHandler } from 'h3' | ||
import { refreshUserSession, requireUserSession } from '../utils/session' | ||
import { getUserSession, refreshUserSession } from '../utils/session' | ||
|
||
export default eventHandler(async (event) => { | ||
await requireUserSession(event) | ||
await getUserSession(event) | ||
await refreshUserSession(event) | ||
|
||
return { refreshed: true } | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
import { eventHandler } from 'h3' | ||
import { requireUserSession, sessionHooks } from '../utils/session' | ||
import { getUserSession, sessionHooks } from '../utils/session' | ||
|
||
export default eventHandler(async (event) => { | ||
const session = await requireUserSession(event) | ||
|
||
const session = await getUserSession(event) | ||
await sessionHooks.callHookParallel('fetch', session, event) | ||
|
||
return session | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { sendRedirect } from 'h3' | ||
import { devEventHandler } from '../lib/oidc' | ||
import { setUserSession } from '../utils/session' | ||
import type { UserSession } from '../../types/session' | ||
|
||
export default devEventHandler({ | ||
async onSuccess(event, { user }) { | ||
await setUserSession(event, user) | ||
await setUserSession(event, user as UserSession) | ||
return sendRedirect(event, '/') | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
import { sendRedirect } from 'h3' | ||
import { loginEventHandler } from '../lib/oidc' | ||
|
||
export default loginEventHandler({ | ||
async onSuccess(event) { | ||
return sendRedirect(event, '/') | ||
}, | ||
}) | ||
export default loginEventHandler() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import type { H3Error, H3Event } from 'h3' | ||
import type { H3Event } from 'h3' | ||
|
||
export interface OAuthConfig<UserSession> { | ||
onSuccess: ( | ||
event: H3Event, | ||
result: { user: UserSession | null, callbackRedirectUrl?: string } | ||
) => Promise<void> | void | ||
onError?: (event: H3Event, error: H3Error) => Promise<void> | void | ||
} |