1%% This Source Code Form is subject to the terms of the Mozilla Public
2%% License, v. 2.0. If a copy of the MPL was not distributed with this
3%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
4%%
5%% Copyright (c) 2007-2021 VMware, Inc. or its affiliates.  All rights reserved.
6%%
7
8-module(rabbit_authn_backend).
9
10-include("rabbit.hrl").
11
12%% Check a user can log in, given a username and a proplist of
13%% authentication information (e.g. [{password, Password}]). If your
14%% backend is not to be used for authentication, this should always
15%% refuse access.
16%%
17%% Possible responses:
18%% {ok, User}
19%%     Authentication succeeded, and here's the user record.
20%% {error, Error}
21%%     Something went wrong. Log and die.
22%% {refused, Msg, Args}
23%%     Client failed authentication. Log and die.
24-callback user_login_authentication(rabbit_types:username(), [term()] | map()) ->
25    {'ok', rabbit_types:auth_user()} |
26    {'refused', string(), [any()]} |
27    {'error', any()}.
28