diff options
author | Francisco Lopez <fjlopez@gitlab.com> | 2017-11-16 17:03:19 +0100 |
---|---|---|
committer | Francisco Lopez <fjlopez@gitlab.com> | 2017-11-17 10:02:11 +0100 |
commit | 1436598e49792b78f5f753477a9d8c097d666b99 (patch) | |
tree | 2c025f10d38aaa27d850092633933838e37ad8f5 /lib/api/api_guard.rb | |
parent | aa84ef1e1af0bac40279e02e4ce889cb660ed9d0 (diff) | |
download | gitlab-ce-1436598e49792b78f5f753477a9d8c097d666b99.tar.gz |
Moved Exceptions to Gitlab::Auth
Diffstat (limited to 'lib/api/api_guard.rb')
-rw-r--r-- | lib/api/api_guard.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/api/api_guard.rb b/lib/api/api_guard.rb index a07015406b1..1953a613f1d 100644 --- a/lib/api/api_guard.rb +++ b/lib/api/api_guard.rb @@ -93,11 +93,11 @@ module API private def install_error_responders(base) - error_classes = [Gitlab::Auth::UserAuthFinders::MissingTokenError, - Gitlab::Auth::UserAuthFinders::TokenNotFoundError, - Gitlab::Auth::UserAuthFinders::ExpiredError, - Gitlab::Auth::UserAuthFinders::RevokedError, - Gitlab::Auth::UserAuthFinders::InsufficientScopeError] + error_classes = [Gitlab::Auth::MissingTokenError, + Gitlab::Auth::TokenNotFoundError, + Gitlab::Auth::ExpiredError, + Gitlab::Auth::RevokedError, + Gitlab::Auth::InsufficientScopeError] base.__send__(:rescue_from, *error_classes, oauth2_bearer_token_error_handler) # rubocop:disable GitlabSecurity/PublicSend end @@ -106,25 +106,25 @@ module API proc do |e| response = case e - when Gitlab::Auth::UserAuthFinders::MissingTokenError + when Gitlab::Auth::MissingTokenError Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new - when Gitlab::Auth::UserAuthFinders::TokenNotFoundError + when Gitlab::Auth::TokenNotFoundError Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new( :invalid_token, "Bad Access Token.") - when Gitlab::Auth::UserAuthFinders::ExpiredError + when Gitlab::Auth::ExpiredError Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new( :invalid_token, "Token is expired. You can either do re-authorization or token refresh.") - when Gitlab::Auth::UserAuthFinders::RevokedError + when Gitlab::Auth::RevokedError Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new( :invalid_token, "Token was revoked. You have to re-authorize from the user.") - when Gitlab::Auth::UserAuthFinders::InsufficientScopeError + when Gitlab::Auth::InsufficientScopeError # FIXME: ForbiddenError (inherited from Bearer::Forbidden of Rack::Oauth2) # does not include WWW-Authenticate header, which breaks the standard. Rack::OAuth2::Server::Resource::Bearer::Forbidden.new( |