1 defmodule Pleroma.Uploaders.Swift.Keystone do
4 @settings Application.get_env(:pleroma, Pleroma.Uploaders.Swift)
6 def process_url(url) do
8 [Keyword.fetch!(@settings, :auth_url), url],
13 def process_response_body(body) do
19 username = Keyword.fetch!(@settings, :username)
20 password = Keyword.fetch!(@settings, :password)
21 tenant_id = Keyword.fetch!(@settings, :tenant_id)
25 make_auth_body(username, password, tenant_id),
26 ["Content-Type": "application/json"],
29 {:ok, %HTTPoison.Response{status_code: 200, body: body}} ->
30 body["access"]["token"]["id"]
32 {:ok, %HTTPoison.Response{status_code: _}} ->
37 def make_auth_body(username, password, tenant) do
40 :passwordCredentials => %{
41 :username => username,