Files
jongryangje/app/Config/Auth.php
taekyoungc a3f92cd322 feat: TOTP 2차 인증, 관리자 메뉴/대시보드 및 의존성 반영
- robthree/twofactorauth, Auth 설정·TotpService·2FA 뷰·라우트
- member TOTP 컬럼 DDL(login_tables, member_add_totp.sql)
- 관리자 메뉴·레이아웃·필터·대시보드 등 연관 변경
- env 샘플에 auth.requireTotp 주석

Made-with: Cursor
2026-03-26 15:30:32 +09:00

53 lines
1.5 KiB
PHP

<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* 로그인·2차 인증(TOTP) 관련 설정
*
* .env 예:
* auth.requireTotp = true
* auth.totpIssuer = "쓰레기봉투 물류시스템"
*/
class Auth extends BaseConfig
{
/** 운영·스테이징 true 권장. 로컬 개발 시 false 로 1단계만 로그인 가능 */
public bool $requireTotp = true;
/** 인증 앱에 표시되는 발급자(issuer) */
public string $totpIssuer = '쓰레기봉투 물류시스템';
/** TOTP 연속 실패 시 세션 종료 전 허용 횟수 */
public int $totpMaxAttempts = 5;
/** 비밀번호 통과 후 2단계 완료까지 허용 시간(초) */
public int $pending2faTtlSeconds = 600;
public function __construct()
{
parent::__construct();
$require = env('auth.requireTotp');
if ($require !== null && $require !== '') {
$this->requireTotp = filter_var($require, FILTER_VALIDATE_BOOLEAN);
}
$issuer = env('auth.totpIssuer');
if (is_string($issuer) && $issuer !== '') {
$this->totpIssuer = $issuer;
}
$max = env('auth.totpMaxAttempts');
if ($max !== null && $max !== '' && is_numeric($max)) {
$this->totpMaxAttempts = max(1, (int) $max);
}
$ttl = env('auth.pending2faTtlSeconds');
if ($ttl !== null && $ttl !== '' && is_numeric($ttl)) {
$this->pending2faTtlSeconds = max(60, (int) $ttl);
}
}
}