Commit 528e677bdc21c417cf031e727a6fe60514864214
1 parent
d17d76a0
Exists in
master
and in
2 other branches
New tests when path is RemoteUser
Showing
2 changed files
with
10 additions
and
10 deletions
Show diff stats
lib/omniauth/strategies/remote_user.rb
| @@ -2,7 +2,7 @@ module OmniAuth | @@ -2,7 +2,7 @@ module OmniAuth | ||
| 2 | module Strategies | 2 | module Strategies |
| 3 | class RemoteUser | 3 | class RemoteUser |
| 4 | include OmniAuth::Strategy | 4 | include OmniAuth::Strategy |
| 5 | - | 5 | + |
| 6 | option :cookie, '_gitlab_session' | 6 | option :cookie, '_gitlab_session' |
| 7 | option :internal_cookie, '_remote_user' | 7 | option :internal_cookie, '_remote_user' |
| 8 | 8 | ||
| @@ -65,8 +65,8 @@ module OmniAuth | @@ -65,8 +65,8 @@ module OmniAuth | ||
| 65 | 65 | ||
| 66 | def redirect_if_not_logging_in(request, url) | 66 | def redirect_if_not_logging_in(request, url) |
| 67 | if ! [ | 67 | if ! [ |
| 68 | - auth_path, | ||
| 69 | - callback_path | 68 | + auth_path, |
| 69 | + callback_path | ||
| 70 | ].include?(request.path_info) | 70 | ].include?(request.path_info) |
| 71 | response = Rack::Response.new | 71 | response = Rack::Response.new |
| 72 | response.redirect url | 72 | response.redirect url |
| @@ -94,17 +94,17 @@ module OmniAuth | @@ -94,17 +94,17 @@ module OmniAuth | ||
| 94 | end | 94 | end |
| 95 | 95 | ||
| 96 | def callback_path | 96 | def callback_path |
| 97 | - "#{auth_path}/callback" | 97 | + "#{auth_path}/callback" |
| 98 | end | 98 | end |
| 99 | 99 | ||
| 100 | def auth_path | 100 | def auth_path |
| 101 | - "#{path_prefix}/RemoteUser" | 101 | + "#{path_prefix}/RemoteUser" |
| 102 | end | 102 | end |
| 103 | - | 103 | + |
| 104 | def sign_out_path | 104 | def sign_out_path |
| 105 | - '/users/sign_out' | 105 | + '/users/sign_out' |
| 106 | end | 106 | end |
| 107 | - | 107 | + |
| 108 | end | 108 | end |
| 109 | end | 109 | end |
| 110 | end | 110 | end |
spec/omniauth/strategies/remote_user_spec.rb
| @@ -85,7 +85,7 @@ describe 'Test Strategy Remote_User' do | @@ -85,7 +85,7 @@ describe 'Test Strategy Remote_User' do | ||
| 85 | context 'Verify omniauth hash with REMOTE_USER_DATA' do | 85 | context 'Verify omniauth hash with REMOTE_USER_DATA' do |
| 86 | before(:each){ | 86 | before(:each){ |
| 87 | clear_cookies | 87 | clear_cookies |
| 88 | - post '/auth/remoteuser/callback', {}, { 'HTTP_REMOTE_USER' => 'foobar', | 88 | + post '/auth/RemoteUser/callback', {}, { 'HTTP_REMOTE_USER' => 'foobar', |
| 89 | 'HTTP_REMOTE_USER_DATA' => JSON.dump({'name' => 'foobar', 'email' => 'foobar@test.com'})} | 89 | 'HTTP_REMOTE_USER_DATA' => JSON.dump({'name' => 'foobar', 'email' => 'foobar@test.com'})} |
| 90 | } | 90 | } |
| 91 | 91 | ||
| @@ -102,7 +102,7 @@ describe 'Test Strategy Remote_User' do | @@ -102,7 +102,7 @@ describe 'Test Strategy Remote_User' do | ||
| 102 | context 'Verify omniauth.auth info without REMOTE_USER_DATA' do | 102 | context 'Verify omniauth.auth info without REMOTE_USER_DATA' do |
| 103 | before(:each){ | 103 | before(:each){ |
| 104 | clear_cookies | 104 | clear_cookies |
| 105 | - post '/auth/remoteuser/callback', {}, { 'HTTP_REMOTE_USER' => 'foobar' } | 105 | + post '/auth/RemoteUser/callback', {}, { 'HTTP_REMOTE_USER' => 'foobar' } |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | it 'Verify uid' do | 108 | it 'Verify uid' do |