шлется на реальный сервер (#2)
build-and-deploy / prepare (push) Successful in 0s
build-and-deploy / build-and-push (., Dockerfile, hr-appeals-web) (push) Successful in 8s
Tests / frontend-test (push) Successful in 11s
build-and-deploy / build-and-push (server, server/Dockerfile, hr-appeals-auth) (push) Successful in 4s
build-and-deploy / deploy (push) Successful in 15s
build-and-deploy / prepare (push) Successful in 0s
build-and-deploy / build-and-push (., Dockerfile, hr-appeals-web) (push) Successful in 8s
Tests / frontend-test (push) Successful in 11s
build-and-deploy / build-and-push (server, server/Dockerfile, hr-appeals-auth) (push) Successful in 4s
build-and-deploy / deploy (push) Successful in 15s
Co-authored-by: Mariya Trishina <trishina.mariya@tnsu.kz> Reviewed-on: http://git.tnsu.kz/gorbenko.pavel/hr-appeals/pulls/2
This commit was merged in pull request #2.
This commit is contained in:
+17
-2
@@ -21,9 +21,24 @@ const REFRESH_MARGIN_MS = 60_000;
|
||||
|
||||
let cached: CachedToken | null = null;
|
||||
|
||||
function readSecret(path: string): string {
|
||||
try {
|
||||
return readFileSync(path, 'utf8');
|
||||
} catch (cause) {
|
||||
// Самая частая причина на свежем клоне — файлов просто нет: в git они не
|
||||
// хранятся. Ошибка ENOENT сама по себе не подсказывает, что делать.
|
||||
throw new Error(
|
||||
`Не удалось прочитать ${path}. Сертификат и ключ в git не хранятся — ` +
|
||||
'положите их в каталог secrets/ (см. secrets/README.md) или укажите ' +
|
||||
'другой каталог через SECRETS_DIR.',
|
||||
{ cause }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function buildClientAssertion(): string {
|
||||
const certificatePem = readFileSync(config.certPath, 'utf8');
|
||||
const privateKey = readFileSync(config.keyPath, 'utf8');
|
||||
const certificatePem = readSecret(config.certPath);
|
||||
const privateKey = readSecret(config.keyPath);
|
||||
|
||||
// x5t — SHA-1 отпечаток DER-сертификата, base64url. По нему Azure AD находит
|
||||
// публичный ключ приложения и проверяет подпись JWT.
|
||||
|
||||
Reference in New Issue
Block a user