1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Uploaders.Swift.Keystone do
8 def process_url(url) do
10 [Pleroma.Config.get!([Pleroma.Uploaders.Swift, :auth_url]), url],
15 def process_response_body(body) do
21 settings = Pleroma.Config.get(Pleroma.Uploaders.Swift)
22 username = Keyword.fetch!(settings, :username)
23 password = Keyword.fetch!(settings, :password)
24 tenant_id = Keyword.fetch!(settings, :tenant_id)
28 make_auth_body(username, password, tenant_id),
29 ["Content-Type": "application/json"],
32 {:ok, %Tesla.Env{status: 200, body: body}} ->
33 body["access"]["token"]["id"]
35 {:ok, %Tesla.Env{status: _}} ->
40 def make_auth_body(username, password, tenant) do
43 :passwordCredentials => %{
44 :username => username,