make allowed_targets an option
This commit is contained in:
parent
a31d15ddf1
commit
6c911407f0
|
@ -62,7 +62,7 @@ GIT
|
|||
|
||||
GIT
|
||||
remote: git://github.com/travis-ci/travis-support.git
|
||||
revision: a350d17b705e3240ff4eae7973266ba36549acaa
|
||||
revision: f78d9161369f574f12b9c0c0dbfe13b997766bdd
|
||||
specs:
|
||||
travis-support (0.0.1)
|
||||
|
||||
|
|
|
@ -39,8 +39,11 @@ class Travis::Api::App
|
|||
#
|
||||
# The entry point is [/auth/post_message](#/auth/post_message).
|
||||
class Authorization < Endpoint
|
||||
set prefix: '/auth'
|
||||
enable :inline_templates
|
||||
set prefix: '/auth', allowed_targets: %r{
|
||||
^ http:// (localhost|127\.0\.0\.1)(:\d+)? $ |
|
||||
^ https:// ([\w\-_]+\.)?travis-ci\.(org|com) $
|
||||
}x
|
||||
|
||||
# Endpoint for retrieving an authorization code, which in turn can be used
|
||||
# to generate an access token.
|
||||
|
@ -222,10 +225,7 @@ class Travis::Api::App
|
|||
end
|
||||
|
||||
def target_ok?(target_origin)
|
||||
target_origin =~ %r{
|
||||
^ http:// (localhost|127\.0\.0\.1)(:\d+)? $ |
|
||||
^ https:// ([\w\-_]+\.)?travis-ci\.(org|com) $
|
||||
}x
|
||||
target_origin =~ settings.allowed_targets
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user