Oneflow v0.2.0 Oneflow.Http.Authorization
This is the the module that allows generating the value for the x-oneflow-authorization header.
Link to this section Summary
Functions
Forms an string with http method, empty space, then path without query string, then another empty space and then the timestamp
Generates authentication header value given the request
%Request{ method: :get, url: "/url"}. and the timestamp
1498601557
Hashes the given string given to sign using the config secret as key
Gets the url path and preppeds /api to it
Link to this section Functions
generate_string_to_sign(String.t(), Oneflow.Http.Request.t(), integer()) :: String.t()
Forms an string with http method, empty space, then path without query string, then another empty space and then the timestamp.
header_value(Oneflow.Http.Request.t(), integer()) :: String.t()
Generates authentication header value given the request
%Request{ method: :get, url: "/url"}. and the timestamp
1498601557.
Returns "token:6f88d384bd48daed9bf03efad5d5b5bdf89f3063".
If the url contains a query string but the path is the same, the value must be the same.
Examples
iex> request = %Oneflow.Http.Request{ method: :get, path: “/url”} iex> Oneflow.Http.Authorization.header_value(request, 498601557) “token:6f88d384bd48daed9bf03efad5d5b5bdf89f3063”
iex> request = %Oneflow.Http.Request{ method: :get, path: “/url?foo=bar”} iex> Oneflow.Http.Authorization.header_value(request, 498601557) “token:6f88d384bd48daed9bf03efad5d5b5bdf89f3063”
Hashes the given string given to sign using the config secret as key.
Gets the url path and preppeds /api to it.