Skip to content

fix: support classpath: prefix in AgentAuthManager credential loading - #19

Merged
Zhoujie628 merged 1 commit into
project-openan:mainfrom
Zhoujie628:main
Aug 17, 2026
Merged

Zhoujie628 merged 1 commit into
project-openan:mainfrom
Zhoujie628:main

Conversation

@Zhoujie628

Copy link
Copy Markdown
Contributor

Problem

AgentAuthManager.loadFromFile() uses new File(path) which does not understand the classpath: prefix. When SpringWorkbenchExecutor passes classpath:spn_agent_credentials.json, the file is silently not found and no credentials are loaded.

Symptom: PROTOCOL logs show A2A-Extensions header but no Authorization header. No [Auth] log output at all.

Root Cause

SpringWorkbenchExecutor.resolveCredentialsPath() returns classpath:spn_agent_credentials.json when the resource exists on classpath. But AgentAuthManager.loadFromFile() does:

File file = new File(path);
if (!file.exists()) {
    return new HashMap<>();  // silent return, no log
}

Fix

  1. Detect classpath: prefix and use ClassLoader.getResourceAsStream()
  2. Add warn logs for missing files (previously silent)

Changes (2 files)

  • AgentAuthManager.java: Add classpath: support in loadFromFile()
  • AgentAuthManagerTest.java: Add 2 test cases for classpath: prefix

Testing

  • mvn test -pl workflow-engine -Dtest=AgentAuthManagerTest passes (4 tests)
  • Verified [Auth] Loaded credentials for N agent(s) from classpath:... log appears

Closes #18

AgentAuthManager.loadFromFile() used new File(path) which does not
understand the classpath: prefix. When SpringWorkbenchExecutor passed
'classpath:spn_agent_credentials.json', the file was silently not found
and no credentials were loaded, resulting in missing Authorization headers.

Fix: detect classpath: prefix and use ClassLoader.getResourceAsStream().
Also add warn logs for missing files (previously silent).

Added 2 test cases:
- loadsCredentialsFromClasspathPrefix
- missingClasspathResourceDoesNotCreateCredentials

Signed-off-by: Zhoujie628 <zhoujie628@users.noreply.github.com>
@Zhoujie628
Zhoujie628 requested a review from a team as a code owner August 17, 2026 07:47
@Zhoujie628
Zhoujie628 merged commit a8d799f into project-openan:main Aug 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: support classpath: prefix in AgentAuthManager credential loading

1 participant