Commit 4188c10c authored by Francisco Lopez's avatar Francisco Lopez

Renaming AuthenticationException to AuthenticationError

parent 7f031791
...@@ -17,7 +17,7 @@ module Gitlab ...@@ -17,7 +17,7 @@ module Gitlab
def find_sessionless_user def find_sessionless_user
find_user_from_access_token || find_user_from_rss_token find_user_from_access_token || find_user_from_rss_token
rescue Gitlab::Auth::AuthenticationException rescue Gitlab::Auth::AuthenticationError
nil nil
end end
end end
......
...@@ -4,14 +4,14 @@ module Gitlab ...@@ -4,14 +4,14 @@ module Gitlab
# Exceptions # Exceptions
# #
AuthenticationException = Class.new(StandardError) AuthenticationError = Class.new(StandardError)
MissingTokenError = Class.new(AuthenticationException) MissingTokenError = Class.new(AuthenticationError)
TokenNotFoundError = Class.new(AuthenticationException) TokenNotFoundError = Class.new(AuthenticationError)
ExpiredError = Class.new(AuthenticationException) ExpiredError = Class.new(AuthenticationError)
RevokedError = Class.new(AuthenticationException) RevokedError = Class.new(AuthenticationError)
UnauthorizedError = Class.new(AuthenticationException) UnauthorizedError = Class.new(AuthenticationError)
class InsufficientScopeError < AuthenticationException class InsufficientScopeError < AuthenticationError
attr_reader :scopes attr_reader :scopes
def initialize(scopes) def initialize(scopes)
@scopes = scopes.map { |s| s.try(:name) || s } @scopes = scopes.map { |s| s.try(:name) || s }
......
...@@ -58,7 +58,7 @@ describe Gitlab::Auth::RequestAuthenticator do ...@@ -58,7 +58,7 @@ describe Gitlab::Auth::RequestAuthenticator do
expect(subject.find_sessionless_user).to be_blank expect(subject.find_sessionless_user).to be_blank
end 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) 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 expect(subject.find_sessionless_user).to be_blank
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment