mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-02 21:24:20 -04:00
Fix guess's sub/sid format
This commit is contained in:
parent
74ee45244b
commit
5a6e29e57a
@ -35,6 +35,7 @@ export const auth = new Elysia({ name: "auth" })
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
// @ts-expect-error ts can't understand that there's two overload idk why
|
// @ts-expect-error ts can't understand that there's two overload idk why
|
||||||
const { payload } = await jwtVerify(bearer, jwtSecret ?? jwks, {
|
const { payload } = await jwtVerify(bearer, jwtSecret ?? jwks, {
|
||||||
issuer: process.env.JWT_ISSUER,
|
issuer: process.env.JWT_ISSUER,
|
||||||
@ -42,6 +43,13 @@ export const auth = new Elysia({ name: "auth" })
|
|||||||
const jwt = validator.Decode(payload);
|
const jwt = validator.Decode(payload);
|
||||||
|
|
||||||
return { jwt };
|
return { jwt };
|
||||||
|
} catch (err) {
|
||||||
|
return error(403, {
|
||||||
|
status: 403,
|
||||||
|
message: "Invalid jwt. Verification vailed",
|
||||||
|
details: err,
|
||||||
|
});
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.macro({
|
.macro({
|
||||||
permissions(perms: string[]) {
|
permissions(perms: string[]) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
Column,
|
type Column,
|
||||||
type ColumnsSelection,
|
type ColumnsSelection,
|
||||||
type SQL,
|
type SQL,
|
||||||
type SQLWrapper,
|
type SQLWrapper,
|
||||||
|
@ -58,8 +58,8 @@ func (h *Handler) createGuestJwt() *string {
|
|||||||
|
|
||||||
claims := maps.Clone(h.config.GuestClaims)
|
claims := maps.Clone(h.config.GuestClaims)
|
||||||
claims["username"] = "guest"
|
claims["username"] = "guest"
|
||||||
claims["sub"] = "guest"
|
claims["sub"] = "00000000-0000-0000-0000-000000000000"
|
||||||
claims["sid"] = "guest"
|
claims["sid"] = "00000000-0000-0000-0000-000000000000"
|
||||||
claims["iss"] = h.config.PublicUrl
|
claims["iss"] = h.config.PublicUrl
|
||||||
claims["iat"] = &jwt.NumericDate{
|
claims["iat"] = &jwt.NumericDate{
|
||||||
Time: time.Now().UTC(),
|
Time: time.Now().UTC(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user