Rename session_token to token to mirror FSS

This commit is contained in:
José Valim 2023-11-16 16:28:57 +01:00
parent 43f40db59d
commit 16e22078f7
2 changed files with 7 additions and 11 deletions

View file

@ -17,7 +17,7 @@ defmodule Livebook.FileSystem.S3 do
@type credentials :: %{
access_key_id: String.t() | nil,
secret_access_key: String.t() | nil,
session_token: String.t() | nil
token: String.t() | nil
}
embedded_schema do
@ -136,21 +136,17 @@ defmodule Livebook.FileSystem.S3 do
{nil, nil} ->
case get_credentials() do
:undefined ->
%{access_key_id: nil, secret_access_key: nil, session_token: nil}
%{access_key_id: nil, secret_access_key: nil, token: nil}
credentials ->
%{
access_key_id: credentials[:access_key_id],
secret_access_key: credentials[:secret_access_key],
session_token: credentials[:token]
}
Map.take(credentials, [:access_key_id, :secret_access_key, :token])
end
_ ->
%{
access_key_id: file_system.access_key_id,
secret_access_key: file_system.secret_access_key,
session_token: nil
token: nil
}
end
end

View file

@ -265,8 +265,8 @@ defmodule Livebook.FileSystem.S3.Client do
headers = [{"Host", host} | headers]
headers =
if credentials.session_token,
do: [{"X-Amz-Security-Token", credentials.session_token} | headers],
if credentials.token,
do: [{"X-Amz-Security-Token", credentials.token} | headers],
else: headers
:aws_signature.sign_v4(
@ -280,7 +280,7 @@ defmodule Livebook.FileSystem.S3.Client do
headers,
body || "",
uri_encode_path: false,
session_token: credentials.session_token
session_token: credentials.token
)
end