Skip to content

Commit 7ba804f

Browse files
authored
fix: change of Identity domain (#336)
1 parent 4f117ea commit 7ba804f

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

veadk/cloud/cloud_agent_engine.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -303,28 +303,28 @@ def deploy(
303303

304304
if auth_method == "oauth2":
305305
# Get or create the Identity user pool.
306-
identity_user_pool_id = self._veidentity_service.get_user_pool(
306+
identity_user_pool = self._veidentity_service.get_user_pool(
307307
name=identity_user_pool_name,
308308
)
309-
if not identity_user_pool_id:
310-
identity_user_pool_id = self._veidentity_service.create_user_pool(
309+
if not identity_user_pool:
310+
identity_user_pool = self._veidentity_service.create_user_pool(
311311
name=identity_user_pool_name,
312312
)
313-
issuer = f"https://auth.id.{self.region}.volces.com/userpool/{identity_user_pool_id}"
313+
identity_user_pool_id = identity_user_pool[0]
314+
identity_user_pool_domain = identity_user_pool[1]
314315

315316
# Create APIG upstream for Identity.
316-
identity_domain = f"auth.id.{self.region}.volces.com"
317317
veapig_identity_upstream_id = (
318318
self._veapig_service.check_domain_upstream_exist(
319-
domain=identity_domain,
319+
domain=identity_user_pool_domain,
320320
port=443,
321321
gateway_id=veapig_gateway_id,
322322
)
323323
)
324324
if not veapig_identity_upstream_id:
325325
veapig_identity_upstream_id = (
326326
self._veapig_service.create_domain_upstream(
327-
domain=f"auth.id.{self.region}.volces.com",
327+
domain=identity_user_pool_domain,
328328
port=443,
329329
is_https=True,
330330
gateway_id=veapig_gateway_id,
@@ -364,9 +364,9 @@ def deploy(
364364

365365
plugin_name = "wasm-oauth2-sso"
366366
plugin_config = {
367-
"AuthorizationUrl": f"{issuer}/authorize",
367+
"AuthorizationUrl": f"https://{identity_user_pool_domain}/authorize",
368368
"UpstreamId": veapig_identity_upstream_id,
369-
"TokenUrl": f"{issuer}/oauth/token",
369+
"TokenUrl": f"https://{identity_user_pool_domain}/oauth/token",
370370
"RedirectPath": "/callback",
371371
"SignoutPath": "/signout",
372372
"ClientId": identity_client_id,
@@ -377,9 +377,9 @@ def deploy(
377377
plugin_config = {
378378
"RemoteJwks": {
379379
"UpstreamId": veapig_identity_upstream_id,
380-
"Url": f"{issuer}/keys",
380+
"Url": f"https://{identity_user_pool_domain}/keys",
381381
},
382-
"Issuer": issuer,
382+
"Issuer": f"https://{identity_user_pool_domain}",
383383
"ValidateConsumer": False,
384384
}
385385
self._vefaas_service.apig_client.create_plugin_binding(

veadk/integrations/ve_identity/identity_client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -733,22 +733,22 @@ def check_permission(
733733
)
734734
return response.allowed
735735

736-
def create_user_pool(self, name: str) -> str:
736+
def create_user_pool(self, name: str) -> tuple[str, str]:
737737
from volcenginesdkid import CreateUserPoolRequest, CreateUserPoolResponse
738738

739739
request = CreateUserPoolRequest(
740740
name=name,
741741
)
742742
response: CreateUserPoolResponse = self._api_client.create_user_pool(request)
743743

744-
return response.uid
744+
return response.uid, response.domain
745745

746-
def get_user_pool(self, name: str) -> str | None:
746+
def get_user_pool(self, name: str) -> tuple[str, str] | None:
747747
from volcenginesdkid import (
748748
ListUserPoolsRequest,
749749
ListUserPoolsResponse,
750750
FilterForListUserPoolsInput,
751-
DataForListUsersOutput,
751+
DataForListUserPoolsOutput,
752752
)
753753

754754
request = ListUserPoolsRequest(
@@ -762,8 +762,8 @@ def get_user_pool(self, name: str) -> str | None:
762762
if response.total_count == 0:
763763
return None
764764

765-
user_pool: DataForListUsersOutput = response.data[0]
766-
return user_pool.uid
765+
user_pool: DataForListUserPoolsOutput = response.data[0]
766+
return user_pool.uid, user_pool.domain
767767

768768
def create_user_pool_client(
769769
self, user_pool_uid: str, name: str, client_type: str

0 commit comments

Comments
 (0)