anchor.diff:                            false | {ok, rbac_identity()} | {error, term()}.
   authenticate(undefined) ->
       {ok, {"", anonymous}};
  -authenticate({token, Token} = Param) ->
  -    case ns_node_disco:couchdb_node() == node() of
  +authenticate({token, Token}) ->
  +    case menelaus_ui_auth:check(Token) of
           false ->
  -            case menelaus_ui_auth:check(Token) of
  +            %% this is needed so UI can get /pools on unprovisioned
  +            %% system with leftover cookie
  +            case ns_config_auth:is_system_provisioned() of
                   false ->
  -                    %% this is needed so UI can get /pools on unprovisioned
  -                    %% system with leftover cookie
  -                    case ns_config_auth:is_system_provisioned() of
  -                        false ->
  -                            {ok, {"", wrong_token}};
  -                        true ->
  -                            false
  -                    end;
  -                Other ->
  -                    Other
  -            end;
  -        true ->
  -            rpc:call(ns_node_disco:ns_server_node(), ?MODULE, authenticate, [Param])
  +                    {ok, {"", wrong_token}};
  +                true ->
  +                    false
  +            end;
  +        Other ->
  +            Other
       end;
   authenticate({Username, Password}) ->
       case ns_config_auth:authenticate(Username, Password) of
  
positive.code:          verify_local_token/1]).
  
  %% rpc from ns_couchdb node
  -export([authenticate/1,
           saslauthd_authenticate/2]).
  
  %% External API
  
  
negative.code: -spec saslauthd_authenticate(rbac_user_id(), rbac_password()) ->
                                      false | {ok, rbac_identity()} | {error, term()}.
  saslauthd_authenticate(Username, Password) ->
      case saslauthd_auth:authenticate(Username, Password) of
          true ->
              {ok, {Username, saslauthd}};
          false ->
              false;
          {error, Error} ->
              {error, Error}
      end.
  
  -spec verify_login_creds(rbac_user_id(), rbac_password()) ->
  