summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
authorAlejandro Rodriguez <alejandro@gitlab.com>2016-11-08 18:37:15 +0000
committerRémy Coutable <remy@rymai.me>2016-11-09 12:28:29 +0100
commit32042ef56adfa24ce5952c6f3b7dc97dea5fd2d4 (patch)
tree92b450e0e40160dd1e73be536e8be87129b882f2 /spec/requests
parentb0088b527eacd16773a85ad8f88e49de7c646cf1 (diff)
downloadgitlab-ce-32042ef56adfa24ce5952c6f3b7dc97dea5fd2d4.tar.gz
Merge branch 'unauthenticated-container-registry-access' into 'security'
Restore unauthenticated access to public container registries Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/24284 See merge request !2025 Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/jwt_controller_spec.rb18
1 files changed, 16 insertions, 2 deletions
diff --git a/spec/requests/jwt_controller_spec.rb b/spec/requests/jwt_controller_spec.rb
index f0ef155bd7b..a3e7844b2f3 100644
--- a/spec/requests/jwt_controller_spec.rb
+++ b/spec/requests/jwt_controller_spec.rb
@@ -20,7 +20,7 @@ describe JwtController do
end
end
- context 'when using authorized request' do
+ context 'when using authenticated request' do
context 'using CI token' do
let(:build) { create(:ci_build, :running) }
let(:project) { build.project }
@@ -65,7 +65,7 @@ describe JwtController do
let(:access_token) { create(:personal_access_token, user: user) }
let(:headers) { { authorization: credentials(user.username, access_token.token) } }
- it 'rejects the authorization attempt' do
+ it 'accepts the authorization attempt' do
expect(response).to have_http_status(200)
end
end
@@ -81,6 +81,20 @@ describe JwtController do
end
end
+ context 'when using unauthenticated request' do
+ it 'accepts the authorization attempt' do
+ get '/jwt/auth', parameters
+
+ expect(response).to have_http_status(200)
+ end
+
+ it 'allows read access' do
+ expect(service).to receive(:execute).with(authentication_abilities: Gitlab::Auth.read_authentication_abilities)
+
+ get '/jwt/auth', parameters
+ end
+ end
+
context 'unknown service' do
subject! { get '/jwt/auth', service: 'unknown' }