Compare commits

...
4 changed files with 23 additions and 6 deletions
@@ -94,6 +94,12 @@ spec:
value: {{ .Values.maestro.open_group_id }}
- name: DEDICATED_PROXY
value: {{ .Values.maestro.dedicated_proxy }}
- name: REDIS_DATABASE
value: "{{ .Values.maestro.redis_database }}"
- name: REDIS_HOST
value: {{ .Values.maestro.redis_host }}
- name: REDIS_PORT
value: "{{ .Values.maestro.redis_port }}"
- name: JWT_PRIVATE_KEY
valueFrom:
secretKeyRef:
+3
View File
@@ -45,6 +45,9 @@ maestro:
open_group_id: 401573bb-334f-44b2-b30e-88d4cea31ae9
dedicated_proxy: ""
restricted_ip: ""
redis_host: "product-redis-prd.z4xvqj.0001.use1.cache.amazonaws.com"
redis_port: "6379"
redis_database: "0"
autoscaling:
enabled: false
minReplicas: 1
@@ -8,7 +8,6 @@ import {
HttpStatus,
Inject,
Param,
Patch,
Post,
Put,
Redirect,
@@ -155,9 +154,8 @@ export class IdentityProviderController {
}
const origin = req.headers['origin'] as string;
const langHeader = req.headers['dadosfera-lang'] as string;
const lang = langHeader.substring(0, 2) + langHeader.substring(2).toUpperCase();
const lang = language.substring(0, 2) + language.substring(2).toUpperCase();
const callbackUrl = process.env.ENV !== "prd" ? `${origin}/auth/callback` : `${origin}/${lang}/auth/callback`;
return await this.identityProviderService.getTokenByIdp(code, state, callbackUrl);
@@ -184,11 +182,20 @@ export class IdentityProviderController {
@Get(':id')
@HttpCode(HttpStatus.OK)
@Redirect()
async loginIdp(@Param('id') id: string) {
async loginIdp(@Param('id') id: string, @Req() req: Request, @Language() language: LanguageEnum) {
this.logger.info('GET /identity-providers/:id');
const origin = req.headers['origin'] as string;
console.log('Origin:', origin);
const lang = language.substring(0, 2) + language.substring(2).toUpperCase();
const callbackUrl = process.env.ENV !== "prd" ? `${origin}/auth/callback` : `${origin}/${lang}/auth/callback`;
const redirectUrl =
await this.identityProviderService.loginIdentityProvider(id);
await this.identityProviderService.loginIdentityProvider(id, callbackUrl);
this.logger.info(`Redirecting to: ${redirectUrl}`);
return {
url: redirectUrl,
};
@@ -44,7 +44,7 @@ export class IdentityProviderService implements OnModuleInit {
);
}
async loginIdentityProvider(id: string) {
async loginIdentityProvider(id: string, callbackUrl: string) {
const idp = await lastValueFrom(
this.identityProviderService.FindIdentityProvider({ id }),
);
@@ -83,6 +83,7 @@ export class IdentityProviderService implements OnModuleInit {
code_challenge_method: 'S256',
state,
nonce,
redirect_uri: callbackUrl,
});
const idpUrl = url + '&identity_provider=' + idp.name;
return idpUrl;