mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
Updated useConfig. Added SSO page.
This commit is contained in:
parent
f10c8ba9e2
commit
c58e037a7e
8 changed files with 69 additions and 32 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { createMiddleware, unauthorized, badRequest, serverError } from 'next-basics';
|
||||
import cors from 'cors';
|
||||
import { getSession } from './session';
|
||||
import { getAuthToken, getShareToken } from './auth';
|
||||
import { parseAuthToken, parseShareToken } from './auth';
|
||||
|
||||
export const useCors = createMiddleware(cors());
|
||||
|
||||
|
|
@ -26,8 +26,8 @@ export const useSession = createMiddleware(async (req, res, next) => {
|
|||
});
|
||||
|
||||
export const useAuth = createMiddleware(async (req, res, next) => {
|
||||
const token = await getAuthToken(req);
|
||||
const shareToken = await getShareToken(req);
|
||||
const token = await parseAuthToken(req);
|
||||
const shareToken = await parseShareToken(req);
|
||||
|
||||
if (!token && !shareToken) {
|
||||
return unauthorized(res);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue