diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2010-11-10 17:21:44 +0000 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2010-11-10 17:21:44 +0000 |
| commit | a752dcc6f0486d0ad7275ce54c6150864c0c42b9 (patch) | |
| tree | a928075d151b6100da60627ddf931681ab7eaa28 | |
| parent | 7f814a1a1133fa67f2c88fb6b85693c34f998218 (diff) | |
| download | rabbitmq-server-git-a752dcc6f0486d0ad7275ce54c6150864c0c42b9.tar.gz | |
Beginning of a config mechanism.
| -rw-r--r-- | ebin/rabbit_app.in | 4 | ||||
| -rw-r--r-- | src/rabbit_reader.erl | 13 |
2 files changed, 14 insertions, 3 deletions
diff --git a/ebin/rabbit_app.in b/ebin/rabbit_app.in index 17d05a9919..7d96957473 100644 --- a/ebin/rabbit_app.in +++ b/ebin/rabbit_app.in @@ -31,4 +31,6 @@ {default_permissions, [<<".*">>, <<".*">>, <<".*">>]}, {cluster_nodes, []}, {server_properties, []}, - {collect_statistics, none}]}]}. + {collect_statistics, none}, + {auth_mechanisms, [{'PLAIN', []}, + {'AMQPLAIN', []}]} ]} ]}. diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl index dd5bd61d72..cc00aed0fc 100644 --- a/src/rabbit_reader.erl +++ b/src/rabbit_reader.erl @@ -851,14 +851,23 @@ auth_mechanism_to_module(TypeBin, Sock) -> end. auth_mechanisms(Sock) -> - [Name || {Name, Mechanism} <- rabbit_registry:lookup_all(auth_mechanism), - Mechanism:should_offer(Sock)]. + {ok, Configured} = application:get_env(auth_mechanisms), + [Name || {Name, Module} <- rabbit_registry:lookup_all(auth_mechanism), + Module:should_offer(Sock), + auth_mechanism_offer(Name, Configured)]. auth_mechanisms_binary(Sock) -> list_to_binary( string:join( [atom_to_list(A) || A <- auth_mechanisms(Sock)], " ")). +auth_mechanism_offer(Name, Configured) -> + case [Name0 || {Name0, _Opts} <- Configured, + Name == Name0] of + [] -> false; + _ -> true + end. + auth_phase(Response, State = #v1{auth_mechanism = AuthMechanism, auth_state = AuthState, |
