mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-01-01 12:41:43 +08:00
Rename session_token to token to mirror FSS
This commit is contained in:
parent
43f40db59d
commit
16e22078f7
2 changed files with 7 additions and 11 deletions
|
@ -17,7 +17,7 @@ defmodule Livebook.FileSystem.S3 do
|
||||||
@type credentials :: %{
|
@type credentials :: %{
|
||||||
access_key_id: String.t() | nil,
|
access_key_id: String.t() | nil,
|
||||||
secret_access_key: String.t() | nil,
|
secret_access_key: String.t() | nil,
|
||||||
session_token: String.t() | nil
|
token: String.t() | nil
|
||||||
}
|
}
|
||||||
|
|
||||||
embedded_schema do
|
embedded_schema do
|
||||||
|
@ -136,21 +136,17 @@ defmodule Livebook.FileSystem.S3 do
|
||||||
{nil, nil} ->
|
{nil, nil} ->
|
||||||
case get_credentials() do
|
case get_credentials() do
|
||||||
:undefined ->
|
:undefined ->
|
||||||
%{access_key_id: nil, secret_access_key: nil, session_token: nil}
|
%{access_key_id: nil, secret_access_key: nil, token: nil}
|
||||||
|
|
||||||
credentials ->
|
credentials ->
|
||||||
%{
|
Map.take(credentials, [:access_key_id, :secret_access_key, :token])
|
||||||
access_key_id: credentials[:access_key_id],
|
|
||||||
secret_access_key: credentials[:secret_access_key],
|
|
||||||
session_token: credentials[:token]
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
%{
|
%{
|
||||||
access_key_id: file_system.access_key_id,
|
access_key_id: file_system.access_key_id,
|
||||||
secret_access_key: file_system.secret_access_key,
|
secret_access_key: file_system.secret_access_key,
|
||||||
session_token: nil
|
token: nil
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -265,8 +265,8 @@ defmodule Livebook.FileSystem.S3.Client do
|
||||||
headers = [{"Host", host} | headers]
|
headers = [{"Host", host} | headers]
|
||||||
|
|
||||||
headers =
|
headers =
|
||||||
if credentials.session_token,
|
if credentials.token,
|
||||||
do: [{"X-Amz-Security-Token", credentials.session_token} | headers],
|
do: [{"X-Amz-Security-Token", credentials.token} | headers],
|
||||||
else: headers
|
else: headers
|
||||||
|
|
||||||
:aws_signature.sign_v4(
|
:aws_signature.sign_v4(
|
||||||
|
@ -280,7 +280,7 @@ defmodule Livebook.FileSystem.S3.Client do
|
||||||
headers,
|
headers,
|
||||||
body || "",
|
body || "",
|
||||||
uri_encode_path: false,
|
uri_encode_path: false,
|
||||||
session_token: credentials.session_token
|
session_token: credentials.token
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue