Rivet.Auth.Refresh (rivet_ident v3.5.0)

View Source

Tooling for the second phase of auth: Refresh

TODO: Extract from Phoenix/WebSvc better, abstract so conn isn't needed

  This will require a module that is imported into WebSvc -BJG

Summary

Functions

iex> {:error, "narf!"} = check_refresh_token({:error, "narf!"})

iex> {:error, %Auth.Domain{log: "Invalid authorization"}} = extract_validation_token({:ok, %{sub: "cas2:asdf"}}, %Auth.Domain{}) iex> {:error, %Auth.Domain{log: "Unable to match validation token subject: \"wut\""}} = extract_validation_token({:ok, "wut"}, %Auth.Domain{}) iex> {:error, %Auth.Domain{log: "narf!"}} = extract_validation_token({:error, "narf!"}, %Auth.Domain{})

Functions

assure(auth, arg2)

  1. extract the validaton token from the refresh token
  2. decode & verify the validation token is ours & good
  3. using the sub:uuid from the validation token, verify the signature on the ref token
  4. update connection data (or abort)

iex> assure(%Auth.Domain{}, nil) {:error, %Auth.Domain{log: "Invalid refresh request"}}

check_refresh_token(pass)

iex> {:error, "narf!"} = check_refresh_token({:error, "narf!"})

extract_validation_token(arg, auth)

iex> {:error, %Auth.Domain{log: "Invalid authorization"}} = extract_validation_token({:ok, %{sub: "cas2:asdf"}}, %Auth.Domain{}) iex> {:error, %Auth.Domain{log: "Unable to match validation token subject: \"wut\""}} = extract_validation_token({:ok, "wut"}, %Auth.Domain{}) iex> {:error, %Auth.Domain{log: "narf!"}} = extract_validation_token({:error, "narf!"}, %Auth.Domain{})