anchor.diff:      %% end.
   
   handle_pool_info(Id, Req) ->
  -    reply_json(Req, build_pool_info(Id)).
  +    UserPassword = extract_basic_auth(Req),
  +    reply_json(Req, build_pool_info(Id, UserPassword)).
   
   handle_pool_info_streaming(Id, Req) ->
       %% TODO: this shouldn't be timer driven, but rather should register a callback based on some state change in the Erlang OS
       HTTPRes = Req:ok({"application/json; charset=utf-8",
  -                  [{"Server", "NorthScale menelaus %TODO gitversion%"}],
  -                  chunked}),
  -    Res = build_pool_info(Id),
  +                      [{"Server", "NorthScale menelaus %TODO gitversion%"}],
  +                      chunked}),
  +    UserPassword = extract_basic_auth(Req),
  +    Res = build_pool_info(Id, UserPassword),
       HTTPRes:write_chunk(mochijson2:encode(Res)),
       %% TODO: resolve why mochiweb doesn't support zero chunk... this
       %%       indicates the end of a response for now
       HTTPRes:write_chunk("\n\n\n\n"),
  -    handle_pool_info_streaming(Id, HTTPRes, 3000).
  -
  -handle_pool_info_streaming(Id, HTTPRes, Wait) ->
  +    handle_pool_info_streaming(Id, Req, HTTPRes, 3000).
  +
  +handle_pool_info_streaming(Id, Req, HTTPRes, Wait) ->
       receive
       after Wait ->
  -            Res = build_pool_info(Id),
  -        HTTPRes:write_chunk(mochijson2:encode(Res)),
  -        %% TODO: resolve why mochiweb doesn't support zero chunk... this
  -        %%       indicates the end of a response for now
  -        HTTPRes:write_chunk("\n\n\n\n")
  +            UserPassword = extract_basic_auth(Req),
  +            Res = build_pool_info(Id, UserPassword),
  +            HTTPRes:write_chunk(mochijson2:encode(Res)),
  +            %% TODO: resolve why mochiweb doesn't support zero chunk... this
  +            %%       indicates the end of a response for now
  +            HTTPRes:write_chunk("\n\n\n\n")
       end,
  -    handle_pool_info_streaming(Id, HTTPRes, 10000).
  +    handle_pool_info_streaming(Id, Req, HTTPRes, 10000).
   
   find_bucket_by_id(Pool, Id) ->
       Buckets = expect_prop_value(buckets, Pool),
  
positive.code:                      case PathTokens of
                           [] -> {done, redirect_permanently("/index.html", Req)};
                           ["pools"] ->
                               {need_auth, fun handle_pools/1};
                           ["pools", Id] ->
                               {need_auth, fun handle_pool_info/2, [Id]};
                           ["pools", Id, "stats"] ->
                               {need_auth, fun handle_bucket_stats/3, ["asd", Id]};
                           ["poolsStreaming", Id] ->
                               {need_auth, fun handle_pool_info_streaming/2, [Id]};
                           ["pools", PoolId, "buckets", Id] ->
                               {need_auth, fun handle_bucket_info/3, [PoolId, Id]};
                           ["pools", PoolId, "buckets", Id, "stats"] ->
                               {need_auth, fun handle_bucket_stats/3, [PoolId, Id]};
                           ["alerts"] ->
  
negative.code: % {rest_creds, [{creds, [{"user", [{password, "password"}]},
  %                        {"admin", [{password, "admin"}]}]}
  %              ]}. % An empty list means no login/password auth check.
  
  check_bucket_auth({User, Password}) ->
      % Default pool only for 1.0.
      case ns_config:search_prop(ns_config:get(), pools, "default", empty) of
          empty -> false;
          Pool ->
              Buckets = proplists:get_value(buckets, Pool),
              lists:any(bucket_auth_fun(User, Password),
                        Buckets)
      end.
  
  check_auth(UserPassword) ->
      case ns_config:search_prop(ns_config:get(), rest_creds, creds, empty) of
  