28 lines
866 B
PHP
28 lines
866 B
PHP
<?php
|
|
require_once __DIR__ . '/common.php';
|
|
|
|
auth_session_start_if_needed();
|
|
|
|
$site = ($_GET['site'] ?? 'egbim') === 'eng' ? 'eng' : 'egbim';
|
|
$returnUrl = trim((string) ($_GET['return_url'] ?? auth_site_qna_url($site)));
|
|
|
|
if (!auth_baron_is_configured()) {
|
|
auth_script_redirect('BARON-SSO 설정이 아직 완료되지 않았습니다.', auth_site_base_url($site) . '/index.php');
|
|
}
|
|
|
|
$config = auth_baron_config();
|
|
$statePayload = auth_baron_state_payload($site, $returnUrl);
|
|
$state = auth_store_baron_state($statePayload);
|
|
|
|
$query = http_build_query([
|
|
'client_id' => $config['client_id'],
|
|
'response_type' => 'code',
|
|
'redirect_uri' => auth_baron_redirect_uri(),
|
|
'scope' => $config['scope'],
|
|
'state' => $state,
|
|
'nonce' => $statePayload['nonce'],
|
|
]);
|
|
|
|
header('Location: ' . $config['authorize_endpoint'] . '?' . $query, true, 302);
|
|
exit;
|
|
?>
|