Skip to content

Commit 46c772a

Browse files
authored
Token bug fix (#134)
* setting token in cookie for default hour 4 * fixed issue of verifier controller is not gettign passed through middleware * updated onboarding template * added kyb widget url * code prettified * increased token expiry for kyb
1 parent baf656b commit 46c772a

File tree

8 files changed

+30
-8
lines changed

8 files changed

+30
-8
lines changed

.deploy/deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ spec:
117117
value: __CLIENT_APP_URL__
118118
- name: KYC_WIDGET_URL
119119
value: __KYC_WIDGET_URL__
120+
- name: KYB_WIDGET_URL
121+
value: __KYB_WIDGET_URL__
120122
- name: MAX_MFA_RETRY_ATTEMPT
121123
value: '__MAX_MFA_RETRY_ATTEMPT__'
122124
- name: DASHBOARD_CREDIT_USAGE_NOTIFICATION_QUEUE

.github/workflows/pipeline.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,5 +159,7 @@ jobs:
159159
run: find .deploy/deployment.yaml -type f -exec sed -i -e "s#__CLIENT_APP_URL__#${{ secrets.CLIENT_APP_URL }}#" {} \;
160160
- name: "Replace secrets"
161161
run: find .deploy/deployment.yaml -type f -exec sed -i -e "s#__KYC_WIDGET_URL__#${{ secrets.KYC_WIDGET_URL }}#" {} \;
162+
- name: "Replace secrets"
163+
run: find .deploy/deployment.yaml -type f -exec sed -i -e "s#__KYB_WIDGET_URL__#${{ secrets.KYB_WIDGET_URL }}#" {} \;
162164
- name: "Deploy to GKE"
163165
run: kubectl apply -f .deploy/deployment.yaml

dev.env.sample

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ MFA_REDIRECT_URL='http://localhost:9001/#/studio/mfa'
2727
MAX_MFA_RETRY_ATTEMPT=3
2828
CLIENT_APP_URL=https://entity.dashboard.hypersign.id
2929
KYC_WIDGET_URL=https://verify.hypersign.id
30+
KYB_WIDGET_URL=https://verify.business.hypersign.id
3031

3132

3233

src/customer-onboarding/services/customer-onboarding.service.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,11 @@ export class CustomerOnboardingService {
710710
this.config.get<string>('CLIENT_APP_URL'),
711711
false,
712712
),
713+
urlSanitizer(
714+
this.config.get<string>('KYB_WIDGET_URL') ||
715+
'https://verify.business.hypersign.id',
716+
false,
717+
),
713718
],
714719
env: APP_ENVIRONMENT.dev,
715720
hasDomainVerified: false,

src/mail-notification/constants/templates/credit-request.template.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ export default function getCreditRequestNotificationMail(
4040
</p>
4141
<br>
4242
<ul>
43+
<li><strong>OnboardingId:</strong> ${onboardingId}</li>
4344
<li><strong>UserId:</strong> ${userId}</li>
4445
${emailFields}
4546
<li><strong>Requested Service:</strong> ${requestedService}</li>
46-
<li><strong>OnboardingId:</strong> ${onboardingId}</li>
4747
<li><strong>companyName:</strong> ${companyName}</li>
4848
<li><strong>accountType:</strong> ${type}</li>
4949
${optionalFields}

src/utils/time-constant.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const TIME = {
99
export const COOKIE_CONFIG = {
1010
AUTH: {
1111
name: 'accessToken',
12-
expiry: 30 * TIME.MINUTE * 1000,
12+
expiry: 4 * TIME.HOUR * 1000,
1313
redisExpiryTime: TIME.WEEK,
1414
},
1515
REFRESH: {
@@ -43,14 +43,22 @@ export const getSecondsFromUnit = (time: number, unit: TIME_UNIT) => {
4343
* EXPIRY_CONFIG defines the expiry times for different types of tokens and Redis cache entries used across the system.
4444
*/
4545
export const EXPIRY_CONFIG = {
46-
// KYC and SSI Token for context - verifier Page and Customer App
46+
// KYC and SSI Token for context - kyc verifier Page and Customer App
4747

4848
VERIFIER_CUSTOMER_APP_ACCESS: {
4949
jwtTime: 30,
5050
jwtUnit: TIME_UNIT.MINUTE,
5151
redisExpiryTime: 30 * TIME.MINUTE,
5252
},
5353

54+
// KYC and SSI Token for context - kyb verifier Page and Customer App
55+
56+
VERIFIER_CUSTOMER_KYB_APP_ACCESS: {
57+
jwtTime: 60,
58+
jwtUnit: TIME_UNIT.MINUTE,
59+
redisExpiryTime: 60 * TIME.MINUTE,
60+
},
61+
5462
// All Tokens generated during onboarding flow
5563

5664
ONBOARDING_ACCESS: {

src/webpage-config/controller/webpage-config.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import { AllExceptionsFilter, VerifierParamsDto } from 'src/utils/utils';
3535
@ApiTags('Webpage-config')
3636
@UseFilters(AllExceptionsFilter)
3737
@UsePipes(new ValidationPipe())
38-
@Controller('api/v1/app/')
38+
@Controller('api/v1/app')
3939
export class WebpageConfigController {
4040
constructor(private readonly webpageConfigService: WebpageConfigService) {}
4141

src/webpage-config/services/webpage-config.service.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,10 @@ export class WebpageConfigService {
343343
GRANT_TYPES.access_service_ssi,
344344
TokenModule.ID_SERVICE,
345345
);
346+
const expiryConfig =
347+
serviceType === GRANT_TYPES.access_service_kyb
348+
? EXPIRY_CONFIG.VERIFIER_CUSTOMER_KYB_APP_ACCESS
349+
: EXPIRY_CONFIG.VERIFIER_CUSTOMER_APP_ACCESS;
346350
// generate access tokens
347351
const [ssiAccessTokenDetail, pageAccessTokenDetail] = await Promise.all([
348352
this.appAuthService.getAccessToken(
@@ -353,8 +357,8 @@ export class WebpageConfigService {
353357
sessionId: generateHash(ssiServiceId),
354358
subdomain: ssiServiceDetail.subdomain,
355359
},
356-
EXPIRY_CONFIG.VERIFIER_CUSTOMER_APP_ACCESS.jwtTime,
357-
EXPIRY_CONFIG.VERIFIER_CUSTOMER_APP_ACCESS.jwtUnit,
360+
expiryConfig.jwtTime,
361+
expiryConfig.jwtUnit,
358362
),
359363
this.appAuthService.getAccessToken(
360364
{
@@ -368,8 +372,8 @@ export class WebpageConfigService {
368372
),
369373
subdomain: kycServiceDetail.subdomain,
370374
},
371-
EXPIRY_CONFIG.VERIFIER_CUSTOMER_APP_ACCESS.jwtTime,
372-
EXPIRY_CONFIG.VERIFIER_CUSTOMER_APP_ACCESS.jwtUnit,
375+
expiryConfig.jwtTime,
376+
expiryConfig.jwtUnit,
373377
),
374378
]);
375379
const redisPayload: any = {

0 commit comments

Comments
 (0)