mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-14 09:39:08 +00:00
Compare commits
17
Commits
@@ -94,6 +94,12 @@ spec:
|
|||||||
value: {{ .Values.maestro.open_group_id }}
|
value: {{ .Values.maestro.open_group_id }}
|
||||||
- name: DEDICATED_PROXY
|
- name: DEDICATED_PROXY
|
||||||
value: {{ .Values.maestro.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
|
- name: JWT_PRIVATE_KEY
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ maestro:
|
|||||||
open_group_id: 401573bb-334f-44b2-b30e-88d4cea31ae9
|
open_group_id: 401573bb-334f-44b2-b30e-88d4cea31ae9
|
||||||
dedicated_proxy: ""
|
dedicated_proxy: ""
|
||||||
restricted_ip: ""
|
restricted_ip: ""
|
||||||
|
redis_host: "product-redis-prd.z4xvqj.0001.use1.cache.amazonaws.com"
|
||||||
|
redis_port: "6379"
|
||||||
|
redis_database: "0"
|
||||||
autoscaling:
|
autoscaling:
|
||||||
enabled: false
|
enabled: false
|
||||||
minReplicas: 1
|
minReplicas: 1
|
||||||
|
|||||||
+34
-32
@@ -22,35 +22,37 @@ charts:
|
|||||||
value: 1
|
value: 1
|
||||||
|
|
||||||
# Environment to test Network Policies
|
# Environment to test Network Policies
|
||||||
- name: private-maestro
|
# - name: private-maestro
|
||||||
chart: ../helm-chart
|
# chart: ../helm-chart
|
||||||
values:
|
# values:
|
||||||
- ../helm-chart/values.yaml
|
# - ../helm-chart/values.yaml
|
||||||
set:
|
# set:
|
||||||
- name: app_name
|
# - name: app_name
|
||||||
value: maestro-private
|
# value: maestro-private
|
||||||
- name: maestro.duc_url
|
# - name: maestro.env
|
||||||
value: duc.stg.dadosfera.ai
|
# value: stg
|
||||||
- name: hostname
|
# - name: maestro.duc_url
|
||||||
value: private-maestro.stg.dadosfera.ai
|
# value: duc.stg.dadosfera.ai
|
||||||
- name: maestro.pi_factory_url
|
# - name: hostname
|
||||||
value: pi-factory.dadosfera.ai
|
# value: private-maestro.stg.dadosfera.ai
|
||||||
- name: maestro.in_factory_url
|
# - name: maestro.pi_factory_url
|
||||||
value: in-factory.stg.dadosfera.ai
|
# value: pi-factory.dadosfera.ai
|
||||||
- name: maestro.tr_factory_url
|
# - name: maestro.in_factory_url
|
||||||
value: in-factory.dadosfera.ai
|
# value: in-factory.stg.dadosfera.ai
|
||||||
- name: maestro.open_customer_id
|
# - name: maestro.tr_factory_url
|
||||||
value: b3e3dfe5-b992-4586-a73c-c0b0c00f615d
|
# value: in-factory.dadosfera.ai
|
||||||
- name: maestro.open_group_id
|
# - name: maestro.open_customer_id
|
||||||
value: e3f98a2f-7748-4981-8505-7695c8ca8218
|
# value: b3e3dfe5-b992-4586-a73c-c0b0c00f615d
|
||||||
# Customer id
|
# - name: maestro.open_group_id
|
||||||
- name: maestro.dedicated_proxy
|
# value: e3f98a2f-7748-4981-8505-7695c8ca8218
|
||||||
value: 14d52fd4-d83d-4cdd-be34-bf11cc28b3bd
|
# # Customer id
|
||||||
- name: replicaCount
|
# - name: maestro.dedicated_proxy
|
||||||
value: 1
|
# value: 14d52fd4-d83d-4cdd-be34-bf11cc28b3bd
|
||||||
- name: affinity
|
# - name: replicaCount
|
||||||
value: null
|
# value: 1
|
||||||
- name: resources
|
# - name: affinity
|
||||||
value: null
|
# value: null
|
||||||
- name: maestro.restricted_ip
|
# - name: resources
|
||||||
value: "57.151.113.140/30"
|
# value: null
|
||||||
|
# - name: maestro.restricted_ip
|
||||||
|
# value: "57.151.113.140/30"
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@ async function bootstrap() {
|
|||||||
});
|
});
|
||||||
app.use(helmet());
|
app.use(helmet());
|
||||||
|
|
||||||
if (process.env.ENV === 'prd') {
|
if (process.env.ENV !== 'local') {
|
||||||
app.use('/catalog/register-dataset', json({ limit: '10mb' }));
|
app.use('/catalog/register-dataset', json({ limit: '10mb' }));
|
||||||
app.use('/catalog/register-dataset', urlencoded({ extended: true, limit: '10mb' }));
|
app.use('/catalog/register-dataset', urlencoded({ extended: true, limit: '10mb' }));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export class GoogleLoginStrategy extends PassportStrategy(
|
|||||||
callbackURL: oauthSecrets['google-login'].redirect_uri,
|
callbackURL: oauthSecrets['google-login'].redirect_uri,
|
||||||
scope: ['email', 'profile', 'openid'],
|
scope: ['email', 'profile', 'openid'],
|
||||||
};
|
};
|
||||||
|
console.log("GoogleLoginStrategy", options.clientID, options.callbackURL);
|
||||||
const verify = (
|
const verify = (
|
||||||
accessToken: string,
|
accessToken: string,
|
||||||
refreshToken: string,
|
refreshToken: string,
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import {
|
|||||||
HttpStatus,
|
HttpStatus,
|
||||||
Inject,
|
Inject,
|
||||||
Param,
|
Param,
|
||||||
Patch,
|
|
||||||
Post,
|
Post,
|
||||||
Put,
|
Put,
|
||||||
Redirect,
|
Redirect,
|
||||||
@@ -155,9 +154,8 @@ export class IdentityProviderController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const origin = req.headers['origin'] as string;
|
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`;
|
const callbackUrl = process.env.ENV !== "prd" ? `${origin}/auth/callback` : `${origin}/${lang}/auth/callback`;
|
||||||
|
|
||||||
return await this.identityProviderService.getTokenByIdp(code, state, callbackUrl);
|
return await this.identityProviderService.getTokenByIdp(code, state, callbackUrl);
|
||||||
@@ -184,11 +182,23 @@ export class IdentityProviderController {
|
|||||||
@Get(':id')
|
@Get(':id')
|
||||||
@HttpCode(HttpStatus.OK)
|
@HttpCode(HttpStatus.OK)
|
||||||
@Redirect()
|
@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');
|
this.logger.info('GET /identity-providers/:id');
|
||||||
|
|
||||||
|
|
||||||
|
const frontDomain = req.headers['origin'] as string || req.headers['referer'] as string;
|
||||||
|
this.logger.info(`Front domain: ${frontDomain}`);
|
||||||
|
const host = frontDomain.lastIndexOf('/') !== -1
|
||||||
|
? frontDomain.substring(0, frontDomain.lastIndexOf('/'))
|
||||||
|
: frontDomain;
|
||||||
|
|
||||||
|
const lang = language.substring(0, 2) + language.substring(2).toUpperCase();
|
||||||
|
const callbackUrl = process.env.ENV !== "prd" ? `${host}/auth/callback` : `${host}/${lang}/auth/callback`;
|
||||||
|
|
||||||
const redirectUrl =
|
const redirectUrl =
|
||||||
await this.identityProviderService.loginIdentityProvider(id);
|
await this.identityProviderService.loginIdentityProvider(id, callbackUrl);
|
||||||
|
|
||||||
|
this.logger.info(`Redirecting to: ${redirectUrl}`);
|
||||||
return {
|
return {
|
||||||
url: redirectUrl,
|
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(
|
const idp = await lastValueFrom(
|
||||||
this.identityProviderService.FindIdentityProvider({ id }),
|
this.identityProviderService.FindIdentityProvider({ id }),
|
||||||
);
|
);
|
||||||
@@ -83,6 +83,7 @@ export class IdentityProviderService implements OnModuleInit {
|
|||||||
code_challenge_method: 'S256',
|
code_challenge_method: 'S256',
|
||||||
state,
|
state,
|
||||||
nonce,
|
nonce,
|
||||||
|
redirect_uri: callbackUrl,
|
||||||
});
|
});
|
||||||
const idpUrl = url + '&identity_provider=' + idp.name;
|
const idpUrl = url + '&identity_provider=' + idp.name;
|
||||||
return idpUrl;
|
return idpUrl;
|
||||||
|
|||||||
@@ -24,15 +24,21 @@ export async function getOauthSecrets() {
|
|||||||
const path = process.env.SM_OAUTH_PATH;
|
const path = process.env.SM_OAUTH_PATH;
|
||||||
const secretsManagerClient = new SecretsManagerClient({});
|
const secretsManagerClient = new SecretsManagerClient({});
|
||||||
for (const key in secrets) {
|
for (const key in secrets) {
|
||||||
|
console.log(`Fetching secret for ${key} from path ${path}/${key}`);
|
||||||
const getSecretComand = new GetSecretValueCommand({
|
const getSecretComand = new GetSecretValueCommand({
|
||||||
SecretId: `${path}/${key}`,
|
SecretId: `${path}/${key}`,
|
||||||
});
|
});
|
||||||
const res = await secretsManagerClient
|
const res = await secretsManagerClient
|
||||||
.send(getSecretComand)
|
.send(getSecretComand)
|
||||||
.catch(() => null);
|
.catch((err) => {
|
||||||
|
console.error(`Error fetching secret for ${key}:`, err);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
if (res) {
|
if (res) {
|
||||||
secrets[key] = JSON.parse(res.SecretString);
|
secrets[key] = JSON.parse(res.SecretString);
|
||||||
|
console.log(JSON.parse(res.SecretString).client_id)
|
||||||
} else {
|
} else {
|
||||||
|
console.log("No secret found for", key);
|
||||||
secrets[key] = {
|
secrets[key] = {
|
||||||
client_id: 'id',
|
client_id: 'id',
|
||||||
client_secret: 'id',
|
client_secret: 'id',
|
||||||
|
|||||||
Reference in New Issue
Block a user