15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/mpp/server/decorator.rb', line 15
def make_challenge_response(challenge, realm)
error = Mpp::PaymentRequiredError.new(realm: realm, description: challenge.description)
body = JSON.generate(error.to_problem_details(challenge_id: challenge.id))
= {
"WWW-Authenticate" => challenge.to_www_authenticate(realm),
"Cache-Control" => "no-store",
"Content-Type" => "application/problem+json"
}
{
"_mpp_challenge" => true,
"status" => 402,
"headers" => ,
"body" => body
}
end
|