rename token parameter to github_token for /auth/github
This commit is contained in:
parent
ea183ee620
commit
b005047d95
1
Gemfile
1
Gemfile
|
@ -33,6 +33,7 @@ end
|
|||
group :development do
|
||||
gem 'foreman'
|
||||
gem 'rerun'
|
||||
gem 'debugger'
|
||||
end
|
||||
|
||||
group :development, :test do
|
||||
|
|
|
@ -160,6 +160,7 @@ GEM
|
|||
facter (>= 1.6.12)
|
||||
timers (>= 1.0.0)
|
||||
coderay (1.0.8)
|
||||
columnize (0.3.6)
|
||||
connection_pool (0.9.2)
|
||||
daemons (1.1.9)
|
||||
dalli (2.5.0)
|
||||
|
@ -167,6 +168,13 @@ GEM
|
|||
activerecord
|
||||
rake
|
||||
database_cleaner (0.8.0)
|
||||
debugger (1.2.2)
|
||||
columnize (>= 0.3.1)
|
||||
debugger-linecache (~> 1.1.1)
|
||||
debugger-ruby_core_source (~> 1.1.5)
|
||||
debugger-linecache (1.1.2)
|
||||
debugger-ruby_core_source (>= 1.1.1)
|
||||
debugger-ruby_core_source (1.1.5)
|
||||
diff-lcs (1.1.3)
|
||||
erubis (2.7.0)
|
||||
eventmachine (1.0.0)
|
||||
|
@ -296,6 +304,7 @@ DEPENDENCIES
|
|||
bunny
|
||||
dalli
|
||||
database_cleaner (~> 0.8.0)
|
||||
debugger
|
||||
factory_girl (~> 2.4.0)
|
||||
foreman
|
||||
gh!
|
||||
|
|
|
@ -76,9 +76,9 @@ class Travis::Api::App
|
|||
#
|
||||
# Parameters:
|
||||
#
|
||||
# * **token**: GitHub token for checking authorization (required)
|
||||
# * **github_token**: GitHub token for checking authorization (required)
|
||||
post '/github' do
|
||||
{ 'access_token' => github_to_travis(params[:token], app_id: 1) }
|
||||
{ 'access_token' => github_to_travis(params[:github_token], app_id: 1) }
|
||||
end
|
||||
|
||||
# Endpoint for making sure user authorized Travis CI to access GitHub.
|
||||
|
|
|
@ -33,7 +33,7 @@ describe Travis::Api::App::Endpoint::Authorization do
|
|||
end
|
||||
|
||||
def get_token(github_token)
|
||||
post('/auth/github', token: github_token).should be_ok
|
||||
post('/auth/github', github_token: github_token).should be_ok
|
||||
parsed_body['access_token']
|
||||
end
|
||||
|
||||
|
@ -52,12 +52,12 @@ describe Travis::Api::App::Endpoint::Authorization do
|
|||
end
|
||||
|
||||
it 'rejects tokens with user scope' do
|
||||
post('/auth/github', token: 'no repos').should_not be_ok
|
||||
post('/auth/github', github_token: 'no repos').should_not be_ok
|
||||
body.should_not include('access_token')
|
||||
end
|
||||
|
||||
it 'rejects tokens with user scope' do
|
||||
post('/auth/github', token: 'invalid token').should_not be_ok
|
||||
post('/auth/github', github_token: 'invalid token').should_not be_ok
|
||||
body.should_not include('access_token')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,16 +9,22 @@ Gem::Specification.new do |s|
|
|||
s.require_path = 'lib'
|
||||
|
||||
s.authors = [
|
||||
"Konstantin Haase",
|
||||
"Sven Fuchs",
|
||||
"Piotr Sarnacki"
|
||||
"Konstantin Haase",
|
||||
"Piotr Sarnacki",
|
||||
"Mathias Meyer",
|
||||
"Brian Ford",
|
||||
"Henrik Hodne"
|
||||
]
|
||||
|
||||
s.email = [
|
||||
"konstantin.mailinglists@googlemail.com",
|
||||
"me@svenfuchs.com",
|
||||
"konstantin.mailinglists@googlemail.com",
|
||||
"drogus@gmail.com",
|
||||
"meyer@paperplanes.de",
|
||||
"svenfuchs@artweb-design.de",
|
||||
"drogus@gmail.com"
|
||||
"bford@engineyard.com",
|
||||
"me@henrikhodne.com"
|
||||
]
|
||||
|
||||
s.files = [
|
||||
|
@ -28,15 +34,19 @@ Gem::Specification.new do |s|
|
|||
"config.ru",
|
||||
"config/database.yml",
|
||||
"config/newrelic.yml",
|
||||
"config/unicorn.rb",
|
||||
"docs/00_overview.md",
|
||||
"docs/01_cross_origin.md",
|
||||
"lib/travis/api/app.rb",
|
||||
"lib/travis/api/app/access_token.rb",
|
||||
"lib/travis/api/app/base.rb",
|
||||
"lib/travis/api/app/cors.rb",
|
||||
"lib/travis/api/app/endpoint.rb",
|
||||
"lib/travis/api/app/endpoint/accounts.rb",
|
||||
"lib/travis/api/app/endpoint/artifacts.rb",
|
||||
"lib/travis/api/app/endpoint/authorization.rb",
|
||||
"lib/travis/api/app/endpoint/branches.rb",
|
||||
"lib/travis/api/app/endpoint/broadcasts.rb",
|
||||
"lib/travis/api/app/endpoint/builds.rb",
|
||||
"lib/travis/api/app/endpoint/documentation.rb",
|
||||
"lib/travis/api/app/endpoint/documentation/css/bootstrap-responsive.css",
|
||||
|
@ -70,10 +80,12 @@ Gem::Specification.new do |s|
|
|||
"lib/travis/api/app/endpoint/documentation/js/lang-yaml.js",
|
||||
"lib/travis/api/app/endpoint/documentation/js/prettify.js",
|
||||
"lib/travis/api/app/endpoint/endpoints.rb",
|
||||
"lib/travis/api/app/endpoint/events.rb",
|
||||
"lib/travis/api/app/endpoint/home.rb",
|
||||
"lib/travis/api/app/endpoint/hooks.rb",
|
||||
"lib/travis/api/app/endpoint/jobs.rb",
|
||||
"lib/travis/api/app/endpoint/repositories.rb",
|
||||
"lib/travis/api/app/endpoint/repos.rb",
|
||||
"lib/travis/api/app/endpoint/requests.rb",
|
||||
"lib/travis/api/app/endpoint/stats.rb",
|
||||
"lib/travis/api/app/endpoint/users.rb",
|
||||
"lib/travis/api/app/endpoint/workers.rb",
|
||||
|
@ -82,38 +94,69 @@ Gem::Specification.new do |s|
|
|||
"lib/travis/api/app/extensions/smart_constants.rb",
|
||||
"lib/travis/api/app/extensions/subclass_tracker.rb",
|
||||
"lib/travis/api/app/helpers.rb",
|
||||
"lib/travis/api/app/helpers/json_renderer.rb",
|
||||
"lib/travis/api/app/helpers/accept.rb",
|
||||
"lib/travis/api/app/helpers/current_user.rb",
|
||||
"lib/travis/api/app/helpers/flash.rb",
|
||||
"lib/travis/api/app/helpers/mime_types.rb",
|
||||
"lib/travis/api/app/helpers/respond_with.rb",
|
||||
"lib/travis/api/app/middleware.rb",
|
||||
"lib/travis/api/app/middleware/cors.rb",
|
||||
"lib/travis/api/app/middleware/logging.rb",
|
||||
"lib/travis/api/app/middleware/rewrite.rb",
|
||||
"lib/travis/api/app/middleware/scope_check.rb",
|
||||
"lib/travis/api/app/responder.rb",
|
||||
"lib/travis/api/app/responders.rb",
|
||||
"lib/travis/api/app/responders/base.rb",
|
||||
"lib/travis/api/app/responders/image.rb",
|
||||
"lib/travis/api/app/responders/json.rb",
|
||||
"lib/travis/api/app/responders/service.rb",
|
||||
"lib/travis/api/app/responders/xml.rb",
|
||||
"public/images/result/failing.png",
|
||||
"public/images/result/passing.png",
|
||||
"public/images/result/unknown.png",
|
||||
"script/console",
|
||||
"script/server",
|
||||
"spec/app_spec.rb",
|
||||
"spec/default_spec.rb",
|
||||
"spec/endpoint/accounts_spec.rb",
|
||||
"spec/endpoint/artifacts_spec.rb",
|
||||
"spec/endpoint/authorization_spec.rb",
|
||||
"spec/endpoint/branches_spec.rb",
|
||||
"spec/endpoint/builds_spec.rb",
|
||||
"spec/endpoint/documentation_spec.rb",
|
||||
"spec/endpoint/endpoints_spec.rb",
|
||||
"spec/endpoint/hooks_spec.rb",
|
||||
"spec/endpoint/jobs_spec.rb",
|
||||
"spec/endpoint/repositories_spec.rb",
|
||||
"spec/endpoint/users_spec.rb",
|
||||
"spec/endpoint/workers_spec.rb",
|
||||
"spec/endpoint_spec.rb",
|
||||
"spec/extensions/scoping_spec.rb",
|
||||
"spec/extensions/smart_constants_spec.rb",
|
||||
"spec/extensions/subclass_tracker_spec.rb",
|
||||
"spec/helpers/json_renderer_spec.rb",
|
||||
"spec/middleware/cors_spec.rb",
|
||||
"spec/middleware/logging_spec.rb",
|
||||
"spec/middleware/scope_check_spec.rb",
|
||||
"spec/middleware_spec.rb",
|
||||
"spec/integration/routes.backup.rb",
|
||||
"spec/integration/v1/branches_spec.rb",
|
||||
"spec/integration/v1/builds_spec.rb",
|
||||
"spec/integration/v1/hooks_spec.rb",
|
||||
"spec/integration/v1/jobs_spec.rb",
|
||||
"spec/integration/v1/repositories_spec.rb",
|
||||
"spec/integration/v1/workers_spec.rb",
|
||||
"spec/integration/v1_spec.backup.rb",
|
||||
"spec/integration/v2/branches_spec.rb",
|
||||
"spec/integration/v2/builds_spec.rb",
|
||||
"spec/integration/v2/hooks_spec.rb",
|
||||
"spec/integration/v2/jobs_spec.rb",
|
||||
"spec/integration/v2/repositories_spec.rb",
|
||||
"spec/integration/v2/users_spec.rb",
|
||||
"spec/integration/v2/workers_spec.rb",
|
||||
"spec/integration/v2_spec.backup.rb",
|
||||
"spec/spec_helper.rb",
|
||||
"spec/support/factories.rb",
|
||||
"spec/support/matchers.rb",
|
||||
"spec/unit/app_spec.rb",
|
||||
"spec/unit/cors_spec.rb",
|
||||
"spec/unit/default_spec.rb",
|
||||
"spec/unit/endpoint/accounts_spec.rb",
|
||||
"spec/unit/endpoint/artifacts_spec.rb",
|
||||
"spec/unit/endpoint/authorization/user_manager_spec.rb",
|
||||
"spec/unit/endpoint/authorization_spec.rb",
|
||||
"spec/unit/endpoint/branches_spec.rb",
|
||||
"spec/unit/endpoint/builds_spec.rb",
|
||||
"spec/unit/endpoint/documentation_spec.rb",
|
||||
"spec/unit/endpoint/endpoints_spec.rb",
|
||||
"spec/unit/endpoint/hooks_spec.rb",
|
||||
"spec/unit/endpoint/jobs_spec.rb",
|
||||
"spec/unit/endpoint/repos_spec.rb",
|
||||
"spec/unit/endpoint/users_spec.rb",
|
||||
"spec/unit/endpoint/workers_spec.rb",
|
||||
"spec/unit/endpoint_spec.rb",
|
||||
"spec/unit/extensions/scoping_spec.rb",
|
||||
"spec/unit/extensions/smart_constants_spec.rb",
|
||||
"spec/unit/extensions/subclass_tracker_spec.rb",
|
||||
"spec/unit/helpers/json_renderer_spec.rb",
|
||||
"spec/unit/middleware/logging_spec.rb",
|
||||
"spec/unit/middleware/scope_check_spec.rb",
|
||||
"spec/unit/middleware_spec.rb",
|
||||
"spec/unit/responders/service_spec.rb",
|
||||
"travis-api.gemspec"
|
||||
]
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user