mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
add more logs
This commit is contained in:
parent
f04d156e5c
commit
c8c91ebf4e
@ -1,6 +1,7 @@
|
|||||||
import { SignJWT, jwtVerify } from 'jose'
|
import { SignJWT, jwtVerify } from 'jose'
|
||||||
|
|
||||||
import { LogError } from '@/server/LogError'
|
import { LogError } from '@/server/LogError'
|
||||||
|
import { backendLogger as logger } from '@/server/logger'
|
||||||
|
|
||||||
import { JwtPayloadType } from './payloadtypes/JwtPayloadType'
|
import { JwtPayloadType } from './payloadtypes/JwtPayloadType'
|
||||||
|
|
||||||
@ -13,6 +14,7 @@ export const decode = async (token: string, signkey: Buffer): Promise<JwtPayload
|
|||||||
issuer: 'urn:gradido:issuer',
|
issuer: 'urn:gradido:issuer',
|
||||||
audience: 'urn:gradido:audience',
|
audience: 'urn:gradido:audience',
|
||||||
})
|
})
|
||||||
|
logger.debug('JWT.decode after jwtVerify... payload=', payload)
|
||||||
return payload as unknown as JwtPayloadType
|
return payload as unknown as JwtPayloadType
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return null
|
return null
|
||||||
|
|||||||
@ -162,6 +162,10 @@ export class TransactionLinkResolver {
|
|||||||
}
|
}
|
||||||
// normal redeem code
|
// normal redeem code
|
||||||
if (txLinkFound) {
|
if (txLinkFound) {
|
||||||
|
logger.debug(
|
||||||
|
'TransactionLinkResolver.queryTransactionLink... normal redeem code found=',
|
||||||
|
txLinkFound,
|
||||||
|
)
|
||||||
const user = await DbUser.findOneOrFail({ where: { id: dbTransactionLink.userId } })
|
const user = await DbUser.findOneOrFail({ where: { id: dbTransactionLink.userId } })
|
||||||
let redeemedBy
|
let redeemedBy
|
||||||
if (dbTransactionLink.redeemedBy) {
|
if (dbTransactionLink.redeemedBy) {
|
||||||
@ -173,9 +177,13 @@ export class TransactionLinkResolver {
|
|||||||
return new TransactionLink(dbTransactionLink, new User(user), redeemedBy, communities)
|
return new TransactionLink(dbTransactionLink, new User(user), redeemedBy, communities)
|
||||||
} else {
|
} else {
|
||||||
// disbursement jwt-token
|
// disbursement jwt-token
|
||||||
|
logger.debug(
|
||||||
|
'TransactionLinkResolver.queryTransactionLink... disbursement jwt-token found=',
|
||||||
|
)
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment
|
||||||
const homeCom = await getHomeCommunity()
|
const homeCom = await getHomeCommunity()
|
||||||
const jwtPayload = await decode(code, homeCom.publicKey)
|
const jwtPayload = await decode(code, homeCom.publicKey)
|
||||||
|
logger.debug('TransactionLinkResolver.queryTransactionLink... jwtPayload=', jwtPayload)
|
||||||
if (jwtPayload !== null && jwtPayload instanceof DisbursementJwtPayloadType) {
|
if (jwtPayload !== null && jwtPayload instanceof DisbursementJwtPayloadType) {
|
||||||
const disburseJwtPayload: DisbursementJwtPayloadType = jwtPayload
|
const disburseJwtPayload: DisbursementJwtPayloadType = jwtPayload
|
||||||
transactionLink.communityName = homeCom.name !== null ? homeCom.name : 'unknown'
|
transactionLink.communityName = homeCom.name !== null ? homeCom.name : 'unknown'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user