Skip to content

Commit

Permalink
Add comments to authentication controller to clarify changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsantos-sfdc committed Mar 27, 2024
1 parent 048cf5f commit 03f277c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/controllers/authenticating_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ def heroku_app
end
end

# heroku adds a -xxxx suffix to the app name when creating the web_url for an app
# this method strips out that suffix to use the correct app name when querying the api
# as an example https://my-great-app-f47016ef1d19.herokuapp.com/ would be parsed to
# my-great-app-f47016ef1d19 in the heroku_app method and my-great-app here
def strip_suffix_from_app_name(app_name)
match = app_name.match(/(.*)\-.+/)
if not match
Expand All @@ -39,6 +43,8 @@ def get_app_info(heroku_api, app_name)
def authenticate_user!
auth_header = request.authorization
app_name = heroku_app
# try first to authenticate the request from Bearer token authorization header and
# if that doesn't work try the previous session_id from the cookies
if auth_header
token = auth_header.match(/Bearer (.*)$/)[1]
heroku_api = PlatformAPI.connect_oauth(token)
Expand Down

0 comments on commit 03f277c

Please sign in to comment.