Add Bearer authentication type - #62
Open
gschueler wants to merge 2 commits into
Open
Conversation
Adds "Bearer" as an authentication value alongside None, Basic and OAuth 2.0. The password/token field holds the token, resolved through key storage like the other types, and is sent verbatim as "Authorization: Bearer <token>". Selecting Bearer without a token is a configuration failure, matching Basic's handling of a missing password. Tests cover the header built by getAuthHeader (including a token read from key storage), end-to-end requests against a bearer-protected endpoint for both the step and node step plugins, and the plugin property description. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds first-class Bearer token authentication to the HTTP step plugins, wiring it through the shared HttpBuilder auth header generation and updating plugin configuration metadata and tests to cover the new option.
Changes:
- Added
Beareras a supportedauthenticationoption and implementedAuthorization: Bearer <token>header creation. - Updated plugin configuration description/labels to reflect the password field’s expanded role (password / client secret / token).
- Added/extended unit + integration tests (WireMock) to validate Bearer auth behavior across workflow step and node step plugins.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/edu/ohio/ais/rundeck/HttpBuilder.java | Adds AUTH_BEARER and Bearer header generation in getAuthHeader. |
| src/main/java/edu/ohio/ais/rundeck/HttpDescription.java | Adds Bearer to the authentication select list and retitles the password field. |
| src/test/java/edu/ohio/ais/rundeck/HttpBuilderTest.java | Adds unit tests for Bearer header generation, storage resolution, and config validation. |
| src/test/java/edu/ohio/ais/rundeck/HttpWorkflowStepPluginTest.java | Adds WireMock-backed workflow-step Bearer auth coverage and config validation test. |
| src/test/java/edu/ohio/ais/rundeck/HttpWorkflowNodeStepPluginTest.java | Adds WireMock-backed node-step Bearer auth coverage and config validation test. |
| src/test/java/edu/ohio/ais/rundeck/HttpDescriptionTest.java | New test asserting the authentication property includes Bearer and defaults remain unchanged. |
A password option present but empty resolved to a non-null empty string, so Bearer auth built a meaningless "Bearer " header instead of failing. Treat a blank token as a missing one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Turbo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
Beareras anauthenticationvalue alongsideNone,BasicandOAuth 2.0.Authorization: Bearer <token>.Bearerwithout a token throws aConfigurationFailure, matching howBasichandles a missing password.The persisted option value is
Bearer(title-cased for consistency withNone/Basic/OAuth 2.0).Test plan
./gradlew test— 82 tests, all passing.HttpBuilderTest: 7 cases overgetAuthHeader— plain token, username ignored, no OAuth client built even when a token endpoint is still configured, token read from key storage, missing token →ConfigurationFailure, plus regression checks thatBasicandNoneare unchanged.HttpWorkflowStepPluginTest/HttpWorkflowNodeStepPluginTest: 3 cases each against a WireMock endpoint that requiresAuthorization: Bearer <token>and 401s otherwise — success across all seven HTTP methods, wrong token fails, missing token is a config failure. Confirms the header reaches the wire in both plugins.HttpDescriptionTest: the select values are exactlyNone, Basic, Bearer, OAuth 2.0, and the default remainsNone.🤖 Generated with Claude Code