rabbitmq-server/deps/rabbitmq_auth_backend_oauth2/test/jwks_http_handler.erl

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
753 B
Erlang
Raw Permalink Normal View History

%% This Source Code Form is subject to the terms of the Mozilla Public
%% License, v. 2.0. If a copy of the MPL was not distributed with this
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
%%
%% Copyright (c) 2007-2025 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
%%
2021-02-05 18:23:10 +08:00
-module(jwks_http_handler).
2021-02-05 18:23:10 +08:00
-behavior(cowboy_handler).
-export([init/2, terminate/3]).
init(Req, State) ->
2024-01-03 16:28:36 +08:00
Keys = proplists:get_value(keys, State, []),
Body = rabbit_json:encode(#{keys => Keys}),
2021-02-05 18:23:10 +08:00
Headers = #{<<"content-type">> => <<"application/json">>},
Req2 = cowboy_req:reply(200, Headers, Body, Req),
{ok, Req2, State}.
terminate(_Reason, _Req, _State) ->
ok.