-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
936 require api key #1560
936 require api key #1560
Conversation
|
||
defp assign_current_user(conn, current_user, api_key) when is_nil(current_user) and is_nil(api_key) do | ||
render_401_missing_api_key(conn) | ||
# assign(conn, :current_user, current_user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testing a few things around this 401 missing case, will remove comment after that's done
apps/discovery_api/lib/discovery_api_web/plugs/set_current_user.ex
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks for utilizing the raptor service + raptor to keep api as thin as possible.
end | ||
|
||
defp assign_current_user(conn, current_user, api_key) when is_nil(current_user) and not is_nil(api_key) do | ||
case RaptorService.get_user_id_from_api_key(raptor_url(), api_key) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicholas-goodwin This line here
Ticket Link #936
Description
When REQUIRE_API_KEY is true, require api_key to be passed in as a header for discovery-api requests if the request does not already contain valid user login information. This should result in api_key being required on requests not coming from discovery-ui.
Reminders:
in
mix.exs
?smart_city
is being used (new fields on a struct), were the relevant postman collections updated?