Renaming AuthenticationException to AuthenticationError

This commit is contained in:
Francisco Lopez 2017-11-17 13:33:21 +01:00
parent 7f0317917a
commit 4188c10c07
3 changed files with 9 additions and 9 deletions

View File

@ -17,7 +17,7 @@ module Gitlab
def find_sessionless_user
find_user_from_access_token || find_user_from_rss_token
rescue Gitlab::Auth::AuthenticationException
rescue Gitlab::Auth::AuthenticationError
nil
end
end

View File

@ -4,14 +4,14 @@ module Gitlab
# Exceptions
#
AuthenticationException = Class.new(StandardError)
MissingTokenError = Class.new(AuthenticationException)
TokenNotFoundError = Class.new(AuthenticationException)
ExpiredError = Class.new(AuthenticationException)
RevokedError = Class.new(AuthenticationException)
UnauthorizedError = Class.new(AuthenticationException)
AuthenticationError = Class.new(StandardError)
MissingTokenError = Class.new(AuthenticationError)
TokenNotFoundError = Class.new(AuthenticationError)
ExpiredError = Class.new(AuthenticationError)
RevokedError = Class.new(AuthenticationError)
UnauthorizedError = Class.new(AuthenticationError)
class InsufficientScopeError < AuthenticationException
class InsufficientScopeError < AuthenticationError
attr_reader :scopes
def initialize(scopes)
@scopes = scopes.map { |s| s.try(:name) || s }

View File

@ -58,7 +58,7 @@ describe Gitlab::Auth::RequestAuthenticator do
expect(subject.find_sessionless_user).to be_blank
end
it 'rescue API::APIGuard::AuthenticationException exceptions' do
it 'rescue Gitlab::Auth::AuthenticationError exceptions' do
allow_any_instance_of(described_class).to receive(:find_user_from_access_token).and_raise(Gitlab::Auth::UnauthorizedError)
expect(subject.find_sessionless_user).to be_blank