summaryrefslogtreecommitdiff
path: root/spec/controllers/oauth
diff options
context:
space:
mode:
authorGitLab Release Tools Bot <delivery-team+release-tools@gitlab.com>2021-01-14 10:10:19 +0000
committerGitLab Release Tools Bot <delivery-team+release-tools@gitlab.com>2021-01-14 10:10:19 +0000
commit79ee819cc8486ff0db9cbb401d1b4c51870e9755 (patch)
tree24d3203709efa8ac034549c63afc42e468642df2 /spec/controllers/oauth
parent1ef3b81f122ba52e955bee694c38d6fb4dae3068 (diff)
parent2f14978e280347568a7437aeac121ad70e90bf3c (diff)
downloadgitlab-ce-79ee819cc8486ff0db9cbb401d1b4c51870e9755.tar.gz
Merge remote-tracking branch 'dev/13-7-stable' into 13-7-stable
Diffstat (limited to 'spec/controllers/oauth')
-rw-r--r--spec/controllers/oauth/authorizations_controller_spec.rb33
1 files changed, 19 insertions, 14 deletions
diff --git a/spec/controllers/oauth/authorizations_controller_spec.rb b/spec/controllers/oauth/authorizations_controller_spec.rb
index f811f13def8..2df94a06b3e 100644
--- a/spec/controllers/oauth/authorizations_controller_spec.rb
+++ b/spec/controllers/oauth/authorizations_controller_spec.rb
@@ -51,10 +51,27 @@ RSpec.describe Oauth::AuthorizationsController do
end
end
+ shared_examples "Implicit grant can't be used in confidential application" do
+ context 'when application is confidential' do
+ before do
+ application.update(confidential: true)
+ params[:response_type] = 'token'
+ end
+
+ it 'does not allow the implicit flow' do
+ subject
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(response).to render_template('doorkeeper/authorizations/error')
+ end
+ end
+ end
+
describe 'GET #new' do
subject { get :new, params: params }
include_examples 'OAuth Authorizations require confirmed user'
+ include_examples "Implicit grant can't be used in confidential application"
context 'when the user is confirmed' do
let(:confirmed_at) { 1.hour.ago }
@@ -95,26 +112,14 @@ RSpec.describe Oauth::AuthorizationsController do
subject { post :create, params: params }
include_examples 'OAuth Authorizations require confirmed user'
-
- context 'when application is confidential' do
- before do
- application.update(confidential: true)
- params[:response_type] = 'token'
- end
-
- it 'does not allow the implicit flow' do
- subject
-
- expect(response).to have_gitlab_http_status(:ok)
- expect(response).to render_template('doorkeeper/authorizations/error')
- end
- end
+ include_examples "Implicit grant can't be used in confidential application"
end
describe 'DELETE #destroy' do
subject { delete :destroy, params: params }
include_examples 'OAuth Authorizations require confirmed user'
+ include_examples "Implicit grant can't be used in confidential application"
end
it 'includes Two-factor enforcement concern' do