|
|
@ -12,18 +12,6 @@ export class OAuthStorageService { |
|
|
|
|
|
|
|
|
public constructor(private readonly redisCacheService: RedisCacheService) {} |
|
|
public constructor(private readonly redisCacheService: RedisCacheService) {} |
|
|
|
|
|
|
|
|
public async storeAuthorizationCode( |
|
|
|
|
|
code: string, |
|
|
|
|
|
data: OAuthAuthorizationCode, |
|
|
|
|
|
ttlMs: number = OAuthStorageService.DEFAULT_TTL_MS |
|
|
|
|
|
): Promise<void> { |
|
|
|
|
|
await this.redisCacheService.set( |
|
|
|
|
|
this.getCodeKey(code), |
|
|
|
|
|
JSON.stringify(data), |
|
|
|
|
|
ttlMs |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public async consumeAuthorizationCode( |
|
|
public async consumeAuthorizationCode( |
|
|
code: string |
|
|
code: string |
|
|
): Promise<OAuthAuthorizationCode | null> { |
|
|
): Promise<OAuthAuthorizationCode | null> { |
|
|
@ -43,6 +31,18 @@ export class OAuthStorageService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public async storeAuthorizationCode( |
|
|
|
|
|
code: string, |
|
|
|
|
|
data: OAuthAuthorizationCode, |
|
|
|
|
|
ttlMs: number = OAuthStorageService.DEFAULT_TTL_MS |
|
|
|
|
|
): Promise<void> { |
|
|
|
|
|
await this.redisCacheService.set( |
|
|
|
|
|
this.getCodeKey(code), |
|
|
|
|
|
JSON.stringify(data), |
|
|
|
|
|
ttlMs |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private getCodeKey(code: string): string { |
|
|
private getCodeKey(code: string): string { |
|
|
return `${OAuthStorageService.CODE_KEY_PREFIX}${code}`; |
|
|
return `${OAuthStorageService.CODE_KEY_PREFIX}${code}`; |
|
|
} |
|
|
} |
|
|
|