Skip to content

Automatically apply configuration accesstoken#540

Merged
aaronzi merged 1 commit into
eclipse-basyx:mainfrom
aaronzi:main
May 20, 2026
Merged

Automatically apply configuration accesstoken#540
aaronzi merged 1 commit into
eclipse-basyx:mainfrom
aaronzi:main

Conversation

@aaronzi

@aaronzi aaronzi commented May 20, 2026

Copy link
Copy Markdown
Member

This pull request enhances authentication support by clarifying usage of the accessToken option in the Configuration object, and by adding integration tests to ensure that the Authorization header is correctly attached when using this option. The changes improve both documentation and test coverage for authentication behavior.

Documentation improvements:

  • Updated README.md to document the use of the accessToken property in the Configuration object, clarifying that it enables automatic Bearer token injection and that middleware is only needed for more advanced authentication logic. [1] [2]

Authentication integration tests:

  • Added a test in aasRepo.integration.test.ts to verify that the Authorization header is set when accessToken is provided in the configuration and that the token is correctly sent with requests.
  • Added a similar test in submodelRepo.integration.test.ts to confirm the same behavior for the submodel repository endpoints.

Closes #538

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds first-class support for Configuration.accessToken by automatically injecting an Authorization: Bearer <token> header in the generated runtime, and adds tests/docs to validate and explain the behavior.

Changes:

  • Add bearer-token auto-injection in BaseAPI.createFetchParams when Configuration.accessToken is provided and no Authorization header is already set.
  • Add unit + integration tests to verify header injection for string/function tokens and non-overwrite behavior.
  • Consolidate AAS Repository/Registry generated clients to use the shared src/generated/runtime.ts (removing per-service runtime copies).

Reviewed changes

Copilot reviewed 3 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/generated/runtime.ts Inject Authorization header from Configuration.accessToken in the shared runtime.
src/unit-tests/generated/runtimeAccessToken.test.ts New unit tests covering accessToken injection and non-overwrite cases.
src/integration-tests/aasRepo.integration.test.ts Integration coverage ensuring bearer token is attached for AAS repository calls.
src/integration-tests/submodelRepo.integration.test.ts Integration coverage ensuring bearer token is attached for Submodel repository calls.
src/generated/AasRepositoryService/runtime.ts Removed service-local runtime in favor of shared runtime.
src/generated/AasRepositoryService/index.ts Re-export shared runtime instead of service-local runtime.
src/generated/AasRepositoryService/apis/SerializationAPIApi.ts Point runtime import to shared runtime.
src/generated/AasRepositoryService/apis/DescriptionAPIApi.ts Point runtime import to shared runtime.
src/generated/AasRepositoryService/apis/AssetAdministrationShellRepositoryAPIApi.ts Point runtime import to shared runtime.
src/generated/AasRegistryService/runtime.ts Removed service-local runtime in favor of shared runtime.
src/generated/AasRegistryService/index.ts Re-export shared runtime instead of service-local runtime.
src/generated/AasRegistryService/apis/DescriptionAPIApi.ts Point runtime import to shared runtime.
src/generated/AasRegistryService/apis/AssetAdministrationShellRegistryAPIApi.ts Point runtime import to shared runtime.
README.md Document Configuration.accessToken as automatic bearer-token injection (middleware only for advanced auth).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aaronzi aaronzi merged commit 107396f into eclipse-basyx:main May 20, 2026
4 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.

Bug: Configuration.accessToken(name, scopes) is not used anywhere

2 participants