Current section
Files
Jump to
Current section
Files
lib/exredis_key_auth.ex
defmodule ExredisKeyAuth do
@moduledoc """
This model makes set/get operations using Exredis hex lib
on a Redis instance
"""
alias Exredis, as: E
alias Exredis.Api, as: A
@doc """
Gets a corresponding work_group_id in relation to the keys
"""
def authenticate(access_key, secret_key) do
combined = access_key <> ":" <> secret_key
{:ok, client} = E.start_link()
work_group_id = client |> E.query(["GET", combined])
client |> E.stop
if (work_group_id == :undefined) do
:undefined
else
work_group_id
end
end
end