Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 26, 2025

Implements optional HTTP Basic Authentication for the Mock Repository Manager to support testing Maven configurations requiring authenticated repository access.

Changes

Configuration

  • Added username and password parameters to AbstractStartMojo
  • Configurable via plugin config or properties: -Dmrm.username=user -Dmrm.password=pass
  • Authentication only enabled when username is provided (backward compatible)

Implementation

  • Added jetty-security dependency
  • Implemented HTTP Basic Auth using Jetty's ConstraintSecurityHandler and HashLoginService
  • Protected all paths (/*) when credentials configured
  • Added overloaded constructor to FileSystemServer accepting auth parameters

Testing

  • Added FileSystemServerAuthTest covering:
    • 401 without credentials
    • 401 with invalid credentials
    • Success with valid credentials
    • No auth when username not configured

Usage

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>mrm-maven-plugin</artifactId>
  <configuration>
    <username>testuser</username>
    <password>testpass</password>
  </configuration>
</plugin>

Client configuration in settings.xml:

<server>
  <id>mrm-repository</id>
  <username>testuser</username>
  <password>testpass</password>
</server>
Original prompt

This section details on the original issue you should resolve

<issue_title>Support authentication on repository</issue_title>
<issue_description>Will probably require something like https://www.eclipse.org/jetty/documentation/current/configuring-security.html#_authentication_and_authorization_with_embedded_jetty</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add support for authentication on repository Add HTTP Basic Authentication support for mock repository server Oct 26, 2025
Copilot finished work on behalf of slachiewicz October 26, 2025 09:50
Copilot AI requested a review from slachiewicz October 26, 2025 09:50
@slachiewicz slachiewicz marked this pull request as ready for review November 1, 2025 07:44
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.

Support authentication on repository

2 participants