Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
wattsworth
/
lumen-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
289c7283
authored
Jan 31, 2020
by
source_reader
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
added flag to control app subdomain option
parent
0a2e0eaf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
app/controllers/data_app_controller.rb
app/controllers/data_app_controller.rb
View file @
289c7283
...
@@ -19,16 +19,14 @@ class DataAppController < ApplicationController
...
@@ -19,16 +19,14 @@ class DataAppController < ApplicationController
def
_app_auth_url
def
_app_auth_url
# apps require a proxy server (like nginx)
# apps require a proxy server (like nginx)
return
nil
unless
(
return
nil
unless
request
.
headers
.
key?
(
"HTTP_X_APP_BASE_URI"
)
or
request
.
headers
.
key?
(
"HTTP_X_SUBDOMAIN_APPS"
)
request
.
headers
.
key?
(
"HTTP_X_APP_SERVER_NAME"
))
# try to use the server name header, otherwise try the base_uri
token
=
InterfaceAuthToken
.
create
(
data_app:
@app
,
token
=
InterfaceAuthToken
.
create
(
data_app:
@app
,
user:
current_user
,
user:
current_user
,
expiration:
5
.
minutes
.
from_now
)
expiration:
5
.
minutes
.
from_now
)
# proxy supports subdomains (preferred because more secure and flexible)
# proxy supports subdomains (preferred because more secure and flexible)
if
request
.
headers
.
key?
(
"HTTP_X_APP_SERVER_NAME"
)
if
request
.
headers
[
"HTTP_X_SUBDOMAIN_APPS"
]
==
'true'
server
=
request
.
headers
[
"HTTP_X_APP_SERVER_NAME"
]
server
=
request
.
headers
[
"HTTP_X_APP_SERVER_NAME"
]
scheme
=
request
.
headers
[
"HTTP_X_APP_SERVER_SCHEME"
]
scheme
=
request
.
headers
[
"HTTP_X_APP_SERVER_SCHEME"
]
"
#{
scheme
}
://
#{
token
.
data_app
.
id
}
.app.
#{
server
}
?auth_token=
#{
token
.
value
}
"
"
#{
scheme
}
://
#{
token
.
data_app
.
id
}
.app.
#{
server
}
?auth_token=
#{
token
.
value
}
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment