erlangchicagoboss

Controller filter not run in Chicago Boss


I am trying write a controller filter (at src/lib/http_basic_auth_filter.erl):

-module(http_basic_auth_filter).
-export([before_filter/2]).
-compile({parse_transform, lager_transform}).

before_filter(Config, RequestContext) ->
  lager:info("Config:~p",[Config]),
  lager:info("RequestContex:~p",[RequestContext]),
  Request = proplists:get_value(request, RequestContext),
  Authorization = Request:header(authorization),
  laget:info("Authorization:~p", [Authorization]),
  {ok, RequestContext}.

And I configure in boss.config the controller filter:

{controller_filter_config, [
  {lang, auto},
  {http_basic_auth_filter, undefined}
]},

But when I visit a URL the filter is not running because I never see the log messages. I do all like is explained in: https://github.com/ChicagoBoss/ChicagoBoss/blob/master/READMEs/README_FILTERS.md

How can do the controller filter run? I have searched in Google and Stackoverflow but I don't saw what is falling.


Solution

  • Also need (but is not commented in skel config):

    {controller_filter_modules, [http_basic_auth_filter]},