로그아웃 인증 정리
This commit is contained in:
@@ -224,6 +224,7 @@ control-wifi-observe.service
|
||||
|
||||
- 로그인 세션과 CSRF token을 사용합니다.
|
||||
- Rhymix 사이트 관리자 세션 또는 `/custom/common` 관리자 인증 쿠키가 확인되면 Control 내부 로그인 세션을 발급합니다.
|
||||
- Control 로그아웃은 Control remember token과 세션을 지우고, `/custom/common` 공통 인증 쿠키도 함께 만료합니다.
|
||||
- POST 조작 API는 CSRF 검증을 통과해야 합니다.
|
||||
- sysfs 쓰기와 systemctl 실행 권한은 sudoers 범위로 제한해야 합니다.
|
||||
- 재부팅 API는 CSRF, 로그인 세션, 설정된 확인 문구, 관리자 암호 재검증을 모두 요구합니다.
|
||||
|
||||
@@ -707,6 +707,22 @@ function control_admin_session_from_rhymix_or_custom(): bool
|
||||
return $checked;
|
||||
}
|
||||
|
||||
function clear_common_admin_auth_cookie_if_available(): void
|
||||
{
|
||||
$commonAuth = '/mnt/synology-web/custom/common/auth.php';
|
||||
if (!is_file($commonAuth) || !is_readable($commonAuth)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
require_once $commonAuth;
|
||||
if (function_exists('custom_clear_auth_cookie')) {
|
||||
custom_clear_auth_cookie();
|
||||
}
|
||||
} catch (Throwable) {
|
||||
}
|
||||
}
|
||||
|
||||
function require_login(): void
|
||||
{
|
||||
if (!signed_in()) {
|
||||
|
||||
@@ -10,6 +10,7 @@ $csrf = csrf_token();
|
||||
|
||||
if (isset($_GET['logout'])) {
|
||||
clear_remember_token();
|
||||
clear_common_admin_auth_cookie_if_available();
|
||||
$_SESSION = [];
|
||||
if (ini_get('session.use_cookies')) {
|
||||
$p = session_get_cookie_params();
|
||||
|
||||
Reference in New Issue
Block a user