Skip to content

Commit

Permalink
types
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanspagh committed Feb 15, 2023
1 parent 6a72d5e commit 1d6c90f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/k8s/conn/auth/azure.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ defmodule K8s.Conn.Auth.Azure do
_
) do
if parse_expires(expires_on) <= DateTime.utc_now() do
# TODO current we don't have access to the credential file, so we wont be able to write the refresh token back into this, hence we will request a new token on every request when the original has expired
# TODO current we don't have access to the credential file,
# so we wont be able to write the refresh token back into this,
# hence we will request a new token on every request when the original has expired
{:ok,
%__MODULE__{
token: refresh_token(tenant, refresh_token, client_id)
Expand All @@ -45,6 +47,7 @@ defmodule K8s.Conn.Auth.Azure do

def create(_, _), do: :skip

@spec parse_expires(String.t()) :: DateTime.t()
defp parse_expires(expires_on) do
case Integer.parse(expires_on) do
{expires_on, _} -> DateTime.from_unix!(expires_on)
Expand All @@ -63,6 +66,7 @@ defmodule K8s.Conn.Auth.Azure do
end
end

@spec refresh_token(String.t(), String.t(), String.t()) :: String.t()
defp refresh_token(
tenant,
refresh_token,
Expand Down

0 comments on commit 1d6c90f

Please sign in to comment.