Add docker entrypoint and env loader

This commit is contained in:
Lectom C Han
2026-02-02 18:52:20 +09:00
parent 0037b90573
commit bf86b1d1e7
30 changed files with 2627 additions and 1547 deletions

View File

@@ -5,6 +5,21 @@ $config = require_once dirname(__DIR__) . '/bbs/oidc_config.php';
use Jumbojett\OpenIDConnectClient;
$requiredKeys = ['issuer', 'client_id', 'client_secret', 'redirect_url'];
$missingKeys = [];
foreach ($requiredKeys as $key) {
if (empty($config[$key])) {
$missingKeys[] = $key;
}
}
if (!empty($missingKeys)) {
http_response_code(500);
header('Content-Type: text/plain; charset=utf-8');
echo 'OIDC 설정 누락: ' . implode(', ', $missingKeys);
exit;
}
$oidc = new OpenIDConnectClient(
$config['issuer'],
$config['client_id'],
@@ -17,4 +32,12 @@ $oidc->addScope($config['scopes']);
// 필요한 경우 PKCE 활성화
// $oidc->setCodeChallengeMethod('S256');
$oidc->authenticate();
try {
$oidc->authenticate();
} catch (Throwable $e) {
error_log($e->getMessage());
http_response_code(500);
header('Content-Type: text/plain; charset=utf-8');
echo 'OIDC 인증 중 오류가 발생했습니다.';
exit;
}