2024-02-06 11:48:49 +08:00
|
|
|
%% 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).
|
2024-02-06 11:48:49 +08:00
|
|
|
|
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, []),
|
2022-07-25 23:34:51 +08:00
|
|
|
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.
|