adityamparikh opened a new pull request, #152:
URL: https://github.com/apache/solr-mcp/pull/152
## Summary
Adds optional HTTP Basic Authentication for the SolrJ client. This builds
directly on **#89 by @dolphinium** — it carries their original feature commit
unchanged and adds a small review-cleanup commit on top.
Credit for the feature belongs to @dolphinium (original PR: #89). This PR
exists to fold in the feedback from a code review + simplification pass so the
change can land clean.
## What's included
**dolphinium's feature commit** (unchanged): optional `solr.username` /
`solr.password` properties (bound from `SOLR_USERNAME` / `SOLR_PASSWORD`),
applied via `HttpJdkSolrClient.Builder#withBasicAuthCredentials` only when both
are present. Fully backwards-compatible — existing unauthenticated deployments
are unaffected.
**Review cleanup commit** (no behavioural change):
- `SolrConfig`: replace the inline `username != null && !username.isEmpty()`
guard with Spring's `StringUtils.hasText(username)`, matching the convention
already used in `HttpSecurityConfiguration` and `SearchService`.
- `SolrConfigAuthTest`: drop the hand-rolled superclass-walking `findField`
helper for `ReflectionUtils.findField` / `makeAccessible` / `getField`, and
tighten the over-defensive `equals(x) || equals("Basic " + x)` assertion to an
exact `assertEquals` (verified against `solr-solrj:10.0.0`: the client stores
`"Basic " + Base64(user:pass)` in UTF-8).
## Tests
- `SolrConfigAuthTest`: parameterized coverage of none / username-only /
password-only / blank-username / both.
- `SolrConfigUrlNormalizationTest`: updated to the new record constructor.
- `./gradlew build` passes locally (Spotless + NullAway + full
unit/integration suite incl. Testcontainers).
## Notes
- Supersedes #89; closing that in favour of this is at the maintainers'
discretion.
- No new runtime dependencies.
- Both commits are DCO signed-off.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]