Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aether-users] How can I verify proper authentication before use

Lothar Werzinger wrote:

How can I trigger an early authentication, so that I prevent
getting authentication errors later on

AFAIK, some repository managers/servers allow to configure access control for different repositories or even portions thereof. So testing successful authentication is not a guarantee that later actions do not fail with authorization issues. Just keep in that mind.

For simple setups, trying to resolve some metadata and checking for errors should do.

I would also like to prompt the user for credentials only if the remote
repository requires authentication. Is there a way to query that, so that I
can use the AuthenticationBuilder only when necessary?

Besides the above method of attempting some resolution, there's no means to query a remote repository whether it will require auth.

You should however note that AuthenticationBuilder is just a convenience to build an impl of Authentication and you can simply provide your own impl that prompts for credentials when its fill() method is called. Together with aether-transport-http, this should allow you to lazily fetch credentials.


Benjamin


Back to the top