Skip to content

Commit 1ba91e8

Browse files
committed
chore(ve_identity): Remove redundant logging from identity and token modules
Eliminated unnecessary logger.info statements from IdentityClient and WorkloadTokenManager to reduce log verbosity and improve clarity. No changes to core logic or functionality.
1 parent 9bed908 commit 1ba91e8

File tree

13 files changed

+52
-73
lines changed

13 files changed

+52
-73
lines changed

docs/content/91.auth/1.agent-identity-intro.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ A: Agent Identity 会自动处理:
8282
## 相关资源
8383

8484
### Agent Identity 官方文档
85-
- [Agent Identity API 参考](https://www.volcengine.com/docs/6758/1261038)
85+
- [Agent Identity API 参考](https://www.volcengine.com/docs/86848/1918752)
8686

8787
### 外部资源
8888
- [OAuth2 规范](https://tools.ietf.org/html/rfc6749)
@@ -92,5 +92,5 @@ A: Agent Identity 会自动处理:
9292

9393
如有问题,请:
9494
1. 查看相应文档的常见问题部分
95-
2. 查看 [Agent Identity 官方文档](https://www.volcengine.com/docs/6758/1261038)
95+
2. 查看 [Agent Identity 官方文档](https://www.volcengine.com/docs/86848/1913964)
9696
3. 联系火山引擎技术支持

docs/content/91.auth/2.api-key-outbound.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,5 @@ A: 实现错误处理和重试逻辑。
9494
- [Agent Identity 产品介绍](./1.agent-identity-intro.md)
9595
- [OAuth2 M2M 认证](./3.oauth2-m2m-outbound.md)
9696
- [OAuth2 USER_FEDERATION 认证](./4.oauth2-user-federation-outbound.md)
97-
- [Agent Identity API 参考](https://www.volcengine.com/docs/6758/1261038)
97+
- [Agent Identity API 参考](https://www.volcengine.com/docs/86848/1918752)
9898

docs/content/91.auth/3.oauth2-m2m-outbound.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,5 @@ auth_config = oauth2_auth(
112112
- [Agent Identity 产品介绍](./1.agent-identity-intro.md)
113113
- [API Key 认证](./2.api-key-outbound.md)
114114
- [OAuth2 USER_FEDERATION 认证](./4.oauth2-user-federation-outbound.md)
115-
- [Agent Identity API 参考](https://www.volcengine.com/docs/6758/1261038)
115+
- [Agent Identity API 参考](https://www.volcengine.com/docs/86848/1918752)
116116

docs/content/91.auth/4.oauth2-user-federation-outbound.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,4 +179,4 @@ A: 如需自定义回调地址,需要将授权码(code)、状态(state
179179
- [Agent Identity 产品介绍](./1.agent-identity-intro.md)
180180
- [API Key 认证](./2.api-key-outbound.md)
181181
- [OAuth2 M2M 认证](./3.oauth2-m2m-outbound.md)
182-
- [Agent Identity API 参考](https://www.volcengine.com/docs/6758/1261038)
182+
- [Agent Identity API 参考](https://www.volcengine.com/docs/86848/1918752)

tests/test_ve_identity_auth_config.py

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class TestApiKeyAuth:
3131
def test_api_key_auth_basic(self):
3232
"""Test creating basic API key auth config."""
3333
config = api_key_auth("test-provider")
34-
34+
3535
assert isinstance(config, ApiKeyAuthConfig)
3636
assert config.provider_name == "test-provider"
3737
assert config.auth_type == "api_key"
@@ -41,7 +41,7 @@ def test_api_key_auth_basic(self):
4141
def test_api_key_auth_with_region(self):
4242
"""Test creating API key auth config with custom region."""
4343
config = api_key_auth("test-provider", region="us-east-1")
44-
44+
4545
assert config.provider_name == "test-provider"
4646
assert config.region == "us-east-1"
4747
assert config.auth_type == "api_key"
@@ -63,11 +63,9 @@ class TestOAuth2Auth:
6363
def test_oauth2_auth_basic(self):
6464
"""Test creating basic OAuth2 auth config."""
6565
config = oauth2_auth(
66-
provider_name="github",
67-
scopes=["repo", "user"],
68-
auth_flow="M2M"
66+
provider_name="github", scopes=["repo", "user"], auth_flow="M2M"
6967
)
70-
68+
7169
assert isinstance(config, OAuth2AuthConfig)
7270
assert config.provider_name == "github"
7371
assert config.scopes == ["repo", "user"]
@@ -78,9 +76,10 @@ def test_oauth2_auth_basic(self):
7876

7977
def test_oauth2_auth_with_all_params(self):
8078
"""Test creating OAuth2 auth config with all parameters."""
79+
8180
def on_auth_url_callback(url: str):
8281
pass
83-
82+
8483
config = oauth2_auth(
8584
provider_name="github",
8685
scopes=["repo", "user"],
@@ -89,9 +88,9 @@ def on_auth_url_callback(url: str):
8988
force_authentication=True,
9089
response_for_auth_required="Please authorize",
9190
on_auth_url=on_auth_url_callback,
92-
region="us-west-2"
91+
region="us-west-2",
9392
)
94-
93+
9594
assert config.provider_name == "github"
9695
assert config.scopes == ["repo", "user"]
9796
assert config.auth_flow == "USER_FEDERATION"
@@ -104,39 +103,33 @@ def on_auth_url_callback(url: str):
104103
def test_oauth2_auth_empty_scopes(self):
105104
"""Test that empty scopes raises ValueError."""
106105
with pytest.raises(ValueError, match="scopes cannot be an empty list"):
107-
oauth2_auth(
108-
provider_name="github",
109-
scopes=[],
110-
auth_flow="M2M"
111-
)
106+
oauth2_auth(provider_name="github", scopes=[], auth_flow="M2M")
112107

113108
def test_oauth2_auth_empty_scope_value(self):
114109
"""Test that empty scope value raises ValueError."""
115110
with pytest.raises(ValueError, match="scope values cannot be empty"):
116-
oauth2_auth(
117-
provider_name="github",
118-
scopes=["repo", ""],
119-
auth_flow="M2M"
120-
)
111+
oauth2_auth(provider_name="github", scopes=["repo", ""], auth_flow="M2M")
121112

122113
def test_oauth2_auth_duplicate_scopes_removed(self):
123114
"""Test that duplicate scopes are removed."""
124115
config = oauth2_auth(
125116
provider_name="github",
126117
scopes=["repo", "user", "repo", "user"],
127-
auth_flow="M2M"
118+
auth_flow="M2M",
128119
)
129-
120+
130121
assert config.scopes == ["repo", "user"]
131122

132123
def test_oauth2_auth_invalid_callback_url(self):
133124
"""Test that invalid callback URL raises ValueError."""
134-
with pytest.raises(ValueError, match="callback_url must be a valid HTTP/HTTPS URL"):
125+
with pytest.raises(
126+
ValueError, match="callback_url must be a valid HTTP/HTTPS URL"
127+
):
135128
oauth2_auth(
136129
provider_name="github",
137130
scopes=["repo"],
138131
auth_flow="M2M",
139-
callback_url="invalid-url"
132+
callback_url="invalid-url",
140133
)
141134

142135
def test_oauth2_auth_valid_https_callback_url(self):
@@ -145,9 +138,9 @@ def test_oauth2_auth_valid_https_callback_url(self):
145138
provider_name="github",
146139
scopes=["repo"],
147140
auth_flow="M2M",
148-
callback_url="https://example.com/callback"
141+
callback_url="https://example.com/callback",
149142
)
150-
143+
151144
assert config.callback_url == "https://example.com/callback"
152145

153146
def test_oauth2_auth_valid_http_callback_url(self):
@@ -156,9 +149,9 @@ def test_oauth2_auth_valid_http_callback_url(self):
156149
provider_name="github",
157150
scopes=["repo"],
158151
auth_flow="M2M",
159-
callback_url="http://localhost:8080/callback"
152+
callback_url="http://localhost:8080/callback",
160153
)
161-
154+
162155
assert config.callback_url == "http://localhost:8080/callback"
163156

164157

@@ -168,7 +161,7 @@ class TestWorkloadAuth:
168161
def test_workload_auth_basic(self):
169162
"""Test creating basic workload auth config."""
170163
config = workload_auth("test-provider")
171-
164+
172165
assert isinstance(config, WorkloadAuthConfig)
173166
assert config.provider_name == "test-provider"
174167
assert config.auth_type == "workload"
@@ -178,7 +171,7 @@ def test_workload_auth_basic(self):
178171
def test_workload_auth_with_region(self):
179172
"""Test creating workload auth config with custom region."""
180173
config = workload_auth("test-provider", region="eu-west-1")
181-
174+
182175
assert config.provider_name == "test-provider"
183176
assert config.region == "eu-west-1"
184177
assert config.auth_type == "workload"
@@ -187,4 +180,3 @@ def test_workload_auth_empty_provider_name(self):
187180
"""Test that empty provider_name raises ValueError."""
188181
with pytest.raises(ValueError, match="provider_name cannot be empty"):
189182
workload_auth("")
190-

veadk/agent.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,9 @@ async def run(
298298
final_output = ""
299299
for _prompt in prompt:
300300
message = types.Content(role="user", parts=[types.Part(text=_prompt)])
301-
final_output = await self._run(runner, user_id, session_id, message, stream, auth_request_processor)
301+
final_output = await self._run(
302+
runner, user_id, session_id, message, stream, auth_request_processor
303+
)
302304

303305
# VeADK features
304306
if save_session_to_memory:

veadk/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,4 @@ def getenv(
106106
else:
107107
logger.warning("No `config.yaml` file found.")
108108

109-
settings = VeADKConfig()
109+
settings = VeADKConfig()

veadk/configs/auth_configs.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,42 +17,41 @@
1717

1818
class VeIdentityConfig(BaseSettings):
1919
"""Configuration for VolcEngine Identity Service.
20-
20+
2121
This configuration class manages settings for Agent Identity service,
2222
including region and endpoint information.
23-
23+
2424
Attributes:
2525
region: The VolcEngine region for Identity service.
2626
endpoint: The endpoint URL for Identity service API.
2727
If not provided, will be auto-generated based on region.
2828
"""
29-
29+
3030
model_config = SettingsConfigDict(env_prefix="VEIDENTITY_")
31-
31+
3232
region: str = "cn-beijing"
3333
"""The VolcEngine region for Identity service.
3434
"""
35-
35+
3636
endpoint: str = ""
3737
"""The endpoint URL for Identity service API.
3838
3939
If not provided, the endpoint will be auto-generated based on the region.
4040
"""
41-
41+
4242
def get_endpoint(self) -> str:
4343
"""Get the endpoint URL for Identity service.
44-
44+
4545
Returns the configured endpoint if provided, otherwise generates
4646
the endpoint based on the region.
47-
47+
4848
Returns:
4949
The endpoint URL for Identity service API.
50-
50+
5151
Raises:
5252
ValueError: If region is not supported.
5353
"""
5454
if self.endpoint:
5555
return self.endpoint
56-
57-
return f"id.{self.region}.volces.com"
5856

57+
return f"id.{self.region}.volces.com"

veadk/integrations/ve_identity/auth_mixins.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,9 @@ async def _handle_oauth2_flow_for_readonly_context(
517517

518518
def _create_default_oauth2_poller(self, auth_uri: str, request_dict: dict):
519519
"""Create a default OAuth2 poller for ReadonlyContext scenarios."""
520-
from veadk.integrations.ve_identity.auth_processor import _DefaultOauth2AuthPoller
520+
from veadk.integrations.ve_identity.auth_processor import (
521+
_DefaultOauth2AuthPoller,
522+
)
521523

522524
async def async_token_fetcher():
523525
response = self._identity_client.get_oauth2_token_or_auth_url(

veadk/integrations/ve_identity/auth_processor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ async def get_user_input(prompt: str) -> str:
8585
logger.info(
8686
f"Please open this URL in your browser to authorize: {self.auth_uri}"
8787
)
88-
auth_response_uri = await get_user_input(f"Please enter the callback URL:\n> ")
88+
auth_response_uri = await get_user_input("Please enter the callback URL:\n> ")
8989
auth_response_uri = auth_response_uri.strip()
9090

9191
if not auth_response_uri:

0 commit comments

Comments
 (0)