Skip to content

Deny login early when offline and force_provider_authentication set#1356

Draft
adombeck wants to merge 3 commits intomainfrom
UDENG-9481-fail-early
Draft

Deny login early when offline and force_provider_authentication set#1356
adombeck wants to merge 3 commits intomainfrom
UDENG-9481-fail-early

Conversation

@adombeck
Copy link
Copy Markdown
Contributor

When the session is offline and force_provider_authentication is set, we still used to ask the user for the local password, and only when the correct local password was entered we returned an error.

Let's improve UX by failing early in that case, before asking for a password. Also improves the error message a bit.

UDENG-9481

The error message from `err` can be quite long, making it hard to
distinguish where it ends:

    Could not connect to the provider: Get "https://login.microsoftonline.com/03c73201-ef9e-4182-ae04-0adb51f4a0b6/v2.0/.well-known/openid-configuration": dial tcp: lookup login.microsoftonline.com on 127.0.0.53:53: server misbehaving. Starting session in offline mode.

Let's move the "starting session in offline mode" part before the error
message to make it more visible and to make clear that it does not
belong the message of the connection error.
When the session is offline and force_provider_authentication is set, we
still used to ask the user for the local password, and only when the
correct local password was entered we returned an error.

Let's improve UX by failing early in that case, before asking for a
password. Also improves the error message a bit.

Note that, if sshd is configured to allow login with authd, this leaks
the information if the host can reach the provider or not to anyone try
to connect via SSH. However, that is already the case, since users can
"go back" and check if device authentication is offered or not.
Avoid prepending unhelpful information to the error message displayed to
the user.

The old message was:

    could not create new session for user "test@ubudev1.onmicrosoft.com": Error connecting to provider. Check your network connection.

The new message is:

    Error connecting to provider. Check your network connection.

In the one other case where this function returns an error, we now
prepend the error with a description.
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.

1 participant