Skip to content

Add Bearer authentication type - #62

Open
gschueler wants to merge 2 commits into
mainfrom
bearer-authentication
Open

Add Bearer authentication type#62
gschueler wants to merge 2 commits into
mainfrom
bearer-authentication

Conversation

@gschueler

Copy link
Copy Markdown
Member

Summary

Adds Bearer as an authentication value alongside None, Basic and OAuth 2.0.

  • The password/token field holds the token and is resolved through key storage like the other authentication types, then sent verbatim as Authorization: Bearer <token>.
  • Selecting Bearer without a token throws a ConfigurationFailure, matching how Basic handles a missing password.
  • The password property is retitled to "Password/Client Secret/Token" since it now also carries the bearer token.

The persisted option value is Bearer (title-cased for consistency with None / Basic / OAuth 2.0).

Test plan

./gradlew test — 82 tests, all passing.

  • HttpBuilderTest: 7 cases over getAuthHeader — 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 that Basic and None are unchanged.
  • HttpWorkflowStepPluginTest / HttpWorkflowNodeStepPluginTest: 3 cases each against a WireMock endpoint that requires Authorization: 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.
  • New HttpDescriptionTest: the select values are exactly None, Basic, Bearer, OAuth 2.0, and the default remains None.

🤖 Generated with Claude Code

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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 Bearer as a supported authentication option and implemented Authorization: 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.

Comment thread src/main/java/edu/ohio/ais/rundeck/HttpBuilder.java
Comment thread src/test/java/edu/ohio/ais/rundeck/HttpBuilderTest.java
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>
@mtrudel

mtrudel commented Jul 28, 2026

Copy link
Copy Markdown

Turbo

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.

3 participants