mirror of
https://github.com/nirvana-7777/script.service.ultimate.git
synced 2026-09-23 09:32:22 +02:00
Add Magenta 2.0 (DE)
This commit is contained in:
@@ -426,18 +426,19 @@ class Magenta2Authenticator(BaseOAuth2Authenticator):
|
||||
issuer_url = None
|
||||
oauth_endpoint = None
|
||||
line_auth_endpoint = self._authorize_tokens_url # From manifest
|
||||
backchannel_start_url = None # NEW
|
||||
qr_code_url_template = None # NEW
|
||||
backchannel_start_url = None
|
||||
qr_code_url_template = None # NEW: Get from dynamic endpoints
|
||||
|
||||
# NEW: Get QR code URL from dynamic endpoints (bootstrap)
|
||||
if 'login_qr_code' in self._dynamic_endpoints:
|
||||
qr_code_url_template = self._dynamic_endpoints['login_qr_code']
|
||||
logger.debug(f"QR code URL from dynamic endpoints: {qr_code_url_template}")
|
||||
|
||||
if self._openid_config:
|
||||
issuer_url = self._openid_config.get('issuer')
|
||||
oauth_endpoint = self._openid_config.get('token_endpoint')
|
||||
# NEW: Try to get backchannel from OpenID config
|
||||
backchannel_start_url = self._openid_config.get('backchannel_authentication_endpoint')
|
||||
|
||||
# NEW: Get QR code URL from dynamic endpoints
|
||||
if 'login_qr_code' in self._dynamic_endpoints:
|
||||
qr_code_url_template = self._dynamic_endpoints['login_qr_code']
|
||||
# Get backchannel from OpenID config
|
||||
backchannel_start_url = self._openid_config.get('backchannel_auth_start')
|
||||
|
||||
self._sam3_client = Sam3Client(
|
||||
http_manager=self._http_manager,
|
||||
@@ -447,8 +448,8 @@ class Magenta2Authenticator(BaseOAuth2Authenticator):
|
||||
issuer_url=issuer_url,
|
||||
oauth_token_endpoint=oauth_endpoint,
|
||||
line_auth_endpoint=line_auth_endpoint,
|
||||
backchannel_start_url=backchannel_start_url, # NEW
|
||||
qr_code_url_template=qr_code_url_template # NEW
|
||||
backchannel_start_url=backchannel_start_url,
|
||||
qr_code_url_template=qr_code_url_template # PASS THE QR CODE URL
|
||||
)
|
||||
|
||||
logger.info(
|
||||
@@ -462,7 +463,7 @@ class Magenta2Authenticator(BaseOAuth2Authenticator):
|
||||
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to initialize SAM3/SSO clients: {e}")
|
||||
|
||||
|
||||
def can_use_line_auth(self) -> bool:
|
||||
"""Check if line auth components are available"""
|
||||
return (
|
||||
|
||||
@@ -17,6 +17,7 @@ class BootstrapConfig:
|
||||
openid_config_url: Optional[str] = None
|
||||
account_base_url: Optional[str] = None
|
||||
consumer_accounts_url: Optional[str] = None
|
||||
login_qr_code_url: Optional[str] = None
|
||||
raw_data: Dict[str, Any] = field(default_factory=dict)
|
||||
|
||||
@classmethod
|
||||
@@ -35,6 +36,7 @@ class BootstrapConfig:
|
||||
openid_config_url=base_settings.get('sam3Url'),
|
||||
account_base_url=base_settings.get('accountBaseUrl'),
|
||||
consumer_accounts_url=base_settings.get('consumerAccountsBaseUrl'),
|
||||
login_qr_code_url=base_settings.get('loginQrCodeUrl'),
|
||||
raw_data=bootstrap_data
|
||||
)
|
||||
|
||||
|
||||
@@ -66,6 +66,9 @@ class EndpointManager:
|
||||
if bootstrap.remote_login_url:
|
||||
self._add_endpoint('remote_login', EndpointCategory.AUTHENTICATION, bootstrap.remote_login_url)
|
||||
|
||||
if bootstrap.login_qr_code_url:
|
||||
self._add_endpoint('login_qr_code', EndpointCategory.AUTHENTICATION, bootstrap.login_qr_code_url)
|
||||
|
||||
# Content endpoints
|
||||
if bootstrap.device_tokens_url:
|
||||
self._add_endpoint('device_tokens', EndpointCategory.CONTENT, bootstrap.device_tokens_url)
|
||||
|
||||
@@ -619,8 +619,8 @@ class Sam3Client:
|
||||
self.userinfo_endpoint = openid_config.get('userinfo_endpoint')
|
||||
|
||||
# Get backchannel auth start endpoint
|
||||
if 'backchannel_authentication_endpoint' in openid_config:
|
||||
self.backchannel_start_url = openid_config['backchannel_authentication_endpoint']
|
||||
if 'backchannel_auth_start' in openid_config:
|
||||
self.backchannel_start_url = openid_config['backchannel_auth_start']
|
||||
logger.debug(f"Backchannel auth endpoint from OpenID: {self.backchannel_start_url}")
|
||||
|
||||
# OAuth token endpoint might be different from line auth endpoint
|
||||
|
||||
Reference in New Issue
Block a user