feat(banner): add API for userauth banner fetching#500
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a public callback API to surface SSH SSH_MSG_USERAUTH_BANNER messages to clients (e.g., to display “none” auth login URLs like Tailscale’s) and wires delivery through the connection/authentication stack.
Changes:
- Introduces
UserAuthBannerCallbackandConnection.addUserAuthBanner/removeUserAuthBannerfor clients to register banner listeners. - Plumbs banner callbacks into
AuthenticationManagerandTransportManagerso banners are delivered both during authentication and when no message handler is registered. - Adds JUnit tests covering banner packet parsing and callback notification/exception handling.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/com/trilead/ssh2/packets/PacketUserauthBannerTest.java | Adds test coverage for banner packet language parsing/round-trip. |
| src/test/java/com/trilead/ssh2/auth/AuthenticationManagerBannerTest.java | Adds tests ensuring banner callbacks are notified (and exceptions are ignored) during none auth. |
| src/main/java/com/trilead/ssh2/UserAuthBannerCallback.java | New public callback interface for receiving auth banners. |
| src/main/java/com/trilead/ssh2/transport/TransportManager.java | Adds storage/dispatch for banner callbacks and intercepts unhandled banner packets in the receive loop. |
| src/main/java/com/trilead/ssh2/packets/PacketUserauthBanner.java | Exposes banner language via a new getter. |
| src/main/java/com/trilead/ssh2/Connection.java | Adds connection-level registration/removal API and passes callbacks into transport/auth layers. |
| src/main/java/com/trilead/ssh2/auth/AuthenticationManager.java | Accepts banner callback list and notifies callbacks when banner packets are received. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ab13967 to
b08011d
Compare
Tailscale uses a banner message during "none" authentication to provide a URL to click on. Add a way for clients to fetch it.
b08011d to
96eae22
Compare
|
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.



Tailscale uses a banner message during "none" authentication to provide a URL to click on. Add a way for clients to fetch it.