cfmgrv4 init...4

This commit is contained in:
최준흠 2024-11-01 14:19:41 +09:00
parent dae5a78127
commit 910693e82d
4 changed files with 7 additions and 13 deletions

View File

@ -83,7 +83,7 @@ class UserController extends MVController
if (!$access_code) {
throw new \Exception("구글 로그인 실패");
}
$auth = new GoogleService();
$auth = new GoogleService(new GoogleSocket());
$auth->login($auth->checkUser($access_code));
$this->message = "로그인 성공";
log_message("notice", __FUNCTION__ . $this->message);

View File

@ -4,23 +4,22 @@ namespace App\Services\Auth;
use App\Entities\UserEntity;
// use App\Libraries\MySocket\GoogleSocket\CURL;
use App\Libraries\MySocket\GoogleSocket\API as GoogleSocket;
use App\Models\UserModel;
use CodeIgniter\Exceptions\PageNotFoundException;
class GoogleService extends AuthService
{
private ?UserModel $_model = null;
private $_mysocket = null;
private string $_access_code = "";
public function __construct()
public function __construct(mixed $mySocket)
{
$this->_mysocket = $mySocket;
parent::__construct();
}
public function getMySocket(): GoogleSocket
public function getMySocket(string $access_code): mixed
{
if ($this->_mySocket === null) {
$this->_mySocket = new GoogleSocket();
throw new \Exception("Socket 방식이 지정되지 않았습니다.");
}
$this->_mySocket->setToken($this->_access_code);
return $this->_mySocket;
@ -28,9 +27,8 @@ class GoogleService extends AuthService
public function checkUser(string $access_code): UserEntity
{
try {
$this->_access_code = $access_code;
// Google 서비스 설정
$userSNS_entity = $this->getMySocket()->getUserSNSEntity();
$userSNS_entity = $this->getMySocket($access_code)->getUserSNSEntity();
//local db 사용와의 연결 확인
$user_entity = $this->getModel()->getEntityByPK($userSNS_entity->getParent());
if ($user_entity === null) {

View File

@ -3,11 +3,9 @@
namespace App\Services\Auth;
use App\Entities\UserEntity;
use App\Models\UserModel;
class LocalService extends AuthService
{
private $_model = null;
public function __construct()
{
parent::__construct();

View File

@ -3,11 +3,9 @@
namespace App\Services\Cloudflare;
use App\Entities\Cloudflare\AccountEntity;
use App\Entities\Cloudflare\AuditLogEntity;
use App\Models\Cloudflare\AccountModel;
use App\Models\Cloudflare\AuditLogModel;
use App\Models\Cloudflare\ZoneModel;
use stdClass;
class AuditLogService extends CloudflareService
{