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 | 2 | module Strategies |
| 3 | 3 | class RemoteUser |
| 4 | 4 | include OmniAuth::Strategy |
| 5 | - | |
| 5 | + | |
| 6 | 6 | option :cookie, '_gitlab_session' |
| 7 | 7 | option :internal_cookie, '_remote_user' |
| 8 | 8 | |
| ... | ... | @@ -65,8 +65,8 @@ module OmniAuth |
| 65 | 65 | |
| 66 | 66 | def redirect_if_not_logging_in(request, url) |
| 67 | 67 | if ! [ |
| 68 | - auth_path, | |
| 69 | - callback_path | |
| 68 | + auth_path, | |
| 69 | + callback_path | |
| 70 | 70 | ].include?(request.path_info) |
| 71 | 71 | response = Rack::Response.new |
| 72 | 72 | response.redirect url |
| ... | ... | @@ -94,17 +94,17 @@ module OmniAuth |
| 94 | 94 | end |
| 95 | 95 | |
| 96 | 96 | def callback_path |
| 97 | - "#{auth_path}/callback" | |
| 97 | + "#{auth_path}/callback" | |
| 98 | 98 | end |
| 99 | 99 | |
| 100 | 100 | def auth_path |
| 101 | - "#{path_prefix}/RemoteUser" | |
| 101 | + "#{path_prefix}/RemoteUser" | |
| 102 | 102 | end |
| 103 | - | |
| 103 | + | |
| 104 | 104 | def sign_out_path |
| 105 | - '/users/sign_out' | |
| 105 | + '/users/sign_out' | |
| 106 | 106 | end |
| 107 | - | |
| 107 | + | |
| 108 | 108 | end |
| 109 | 109 | end |
| 110 | 110 | end | ... | ... |
spec/omniauth/strategies/remote_user_spec.rb
| ... | ... | @@ -85,7 +85,7 @@ describe 'Test Strategy Remote_User' do |
| 85 | 85 | context 'Verify omniauth hash with REMOTE_USER_DATA' do |
| 86 | 86 | before(:each){ |
| 87 | 87 | clear_cookies |
| 88 | - post '/auth/remoteuser/callback', {}, { 'HTTP_REMOTE_USER' => 'foobar', | |
| 88 | + post '/auth/RemoteUser/callback', {}, { 'HTTP_REMOTE_USER' => 'foobar', | |
| 89 | 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 | 102 | context 'Verify omniauth.auth info without REMOTE_USER_DATA' do |
| 103 | 103 | before(:each){ |
| 104 | 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 | 108 | it 'Verify uid' do | ... | ... |