mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 07:26:45 +00:00
Merge pull request #4810 from Infisical/PAM-41
pam: return metadata for pam access requests
This commit is contained in:
@@ -92,7 +92,8 @@ export const registerPamAccountRouter = async (server: FastifyZodProvider) => {
|
|||||||
gatewayClientCertificate: z.string(),
|
gatewayClientCertificate: z.string(),
|
||||||
gatewayClientPrivateKey: z.string(),
|
gatewayClientPrivateKey: z.string(),
|
||||||
gatewayServerCertificateChain: z.string(),
|
gatewayServerCertificateChain: z.string(),
|
||||||
relayHost: z.string()
|
relayHost: z.string(),
|
||||||
|
metadata: z.record(z.string(), z.string()).optional()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -480,6 +480,36 @@ export const pamAccountServiceFactory = ({
|
|||||||
throw new NotFoundError({ message: `Gateway connection details for gateway '${gatewayId}' not found.` });
|
throw new NotFoundError({ message: `Gateway connection details for gateway '${gatewayId}' not found.` });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let metadata;
|
||||||
|
|
||||||
|
switch (resourceType) {
|
||||||
|
case PamResource.Postgres:
|
||||||
|
case PamResource.MySQL:
|
||||||
|
{
|
||||||
|
const connectionCredentials = await decryptResourceConnectionDetails({
|
||||||
|
encryptedConnectionDetails: resource.encryptedConnectionDetails,
|
||||||
|
kmsService,
|
||||||
|
projectId: account.projectId
|
||||||
|
});
|
||||||
|
|
||||||
|
const credentials = await decryptAccountCredentials({
|
||||||
|
encryptedCredentials: account.encryptedCredentials,
|
||||||
|
kmsService,
|
||||||
|
projectId: account.projectId
|
||||||
|
});
|
||||||
|
|
||||||
|
metadata = {
|
||||||
|
username: credentials.username,
|
||||||
|
database: connectionCredentials.database,
|
||||||
|
accountName: account.name,
|
||||||
|
accountPath
|
||||||
|
};
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
sessionId: session.id,
|
sessionId: session.id,
|
||||||
resourceType,
|
resourceType,
|
||||||
@@ -491,7 +521,8 @@ export const pamAccountServiceFactory = ({
|
|||||||
gatewayServerCertificateChain: gatewayConnectionDetails.gateway.serverCertificateChain,
|
gatewayServerCertificateChain: gatewayConnectionDetails.gateway.serverCertificateChain,
|
||||||
relayHost: gatewayConnectionDetails.relayHost,
|
relayHost: gatewayConnectionDetails.relayHost,
|
||||||
projectId: account.projectId,
|
projectId: account.projectId,
|
||||||
account
|
account,
|
||||||
|
metadata
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user