Skip to content

Conversation

@labkey-adam
Copy link
Contributor

@labkey-adam labkey-adam commented Jul 16, 2024

Rationale

We want API clients to receive more helpful guidance when authentication fails. For example, password expired vs. password doesn't meet complexity requirements vs. bad credentials. https://www.labkey.org/home/Developer/issues/issues-details.view?issueId=50841

Changes

  • If Basic authentication fails, return a JSON exception with user-appropriate details. Note: This is a behavior change; previously, no exception was returned, the server simply set up a guest session.
  • AuthenticationStatus can now tailor error messages for web UI vs. API purposes. For example, returning a message to a piece of code that suggests checking the caps lock seems unhelpful.

Copy link
Contributor

@labkey-jeckels labkey-jeckels left a comment

Choose a reason for hiding this comment

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

Changes look OK but I suspect the test failures in the BVTs are related.


return null;
// Basic auth has failed so send failure response in a format that APIs can consume
// TODO: Shouldn't our client APIs set a default "respFormat" attribute? Java library doesn't...
Copy link
Contributor

Choose a reason for hiding this comment

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

I added respFormat years ago for a niche use case that could only consume XML. I think it's fine to default to JSON and not bother explicitly requesting it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was necessary to get ClientAPITest to pass, since it sets "respFormat" to XML in a few cases, and was unhappy with hard-coded JSON response. Happy to discuss and clean this up on develop or later 24.7.x... I don't love what feels like one-off handling here.

Copy link
Contributor

@labkey-jeckels labkey-jeckels left a comment

Choose a reason for hiding this comment

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

Please hold off on merging until we have a decision on timing. See my question to the Release Management group in the chat.

@labkey-jeckels labkey-jeckels merged commit d2dab7a into release24.7-SNAPSHOT Jul 23, 2024
@labkey-jeckels labkey-jeckels deleted the 24.7_fb_auth_message branch July 23, 2024 23:42
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.

[MacCoss] Issue 50841: Include detail when basic auth password matches but does not meet complexity rules

3 participants