Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] [JENKINS-6610] Allow clients to request HTTP 401/WWW-Authenticate #1415

Closed
wants to merge 1 commit into from

Conversation

daniel-beck
Copy link
Member

Do not merge, but please share your thoughts on this.


Non-browser clients currently have the problem that they don't get a proper basic auth challenge from Jenkins for access to a restricted resource: It's just HTTP 403 Forbidden, and a redirect to the login form.

OTOH if Jenkins sends the HTTP 401 response and WWW-Authenticate header, web browsers will start showing the login popup window for basic authentication.

Would a solution like this one be acceptable? RSS clients would then need to start requesting e.g. /rssAll?basic to get a proper challenge, if they don't support preemptive authentication. A simple reconfiguration should do it, and for future users all links to RSS feeds on the UI could be changed.

I considered a few other solutions in a recent comment to JENKINS-6610, but all of them seem worse than this.

@fbelzunc
Copy link
Contributor

fbelzunc commented Jan 6, 2015

@daniel-beck Is not enough good the solution you suggest here?

@ndeloof
Copy link
Contributor

ndeloof commented Jan 6, 2015

IMHO a better option would be for a servlet filter to check URI is used for user interaction vs API access : anything /api/*, /rss* and few other would then get WWW-Authenticate header set as expected for basic authentication. Maybe an even better way would be for stapler to handle this based on some annotation on related resource

@fbelzunc
Copy link
Contributor

fbelzunc commented Jan 6, 2015

@daniel-beck If you don't plan to work on this, I will be happy to start.

@daniel-beck
Copy link
Member Author

@fbelzunc As I wrote, this is only request for comments. Feel free implement this properly, a solution is clearly needed. @ndeloof brings up a few good points as well.

@daniel-beck daniel-beck closed this Jan 6, 2015
@cyrille-leclerc
Copy link
Contributor

Few ideas:

  • If a http header Authorization exists in an anonymous HTTP request, then Jenkins should try to authenticate the user with this Authentication header
  • The logic to choose the authentication mechanism (302 redirect to a web form...) should evaluate to HTTP header Accept of the HTTP request and could initiate a basic auth if Accept do not mention html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants