debian-mirror-gitlab/app/controllers/projects/google_cloud/revoke_oauth_controller.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
780 B
Ruby
Raw Normal View History

2022-05-07 20:08:51 +05:30
# frozen_string_literal: true
class Projects::GoogleCloud::RevokeOauthController < Projects::GoogleCloud::BaseController
before_action :validate_gcp_token!
def create
google_api_client = GoogleApi::CloudPlatform::Client.new(token_in_session, nil)
response = google_api_client.revoke_authorizations
if response.success?
redirect_message = { notice: s_('GoogleCloud|Google OAuth2 token revocation requested') }
2022-10-11 01:57:18 +05:30
track_event(:revoke_oauth)
2022-05-07 20:08:51 +05:30
else
redirect_message = { alert: s_('GoogleCloud|Google OAuth2 token revocation request failed') }
2022-10-11 01:57:18 +05:30
track_event(:error)
2022-05-07 20:08:51 +05:30
end
session.delete(GoogleApi::CloudPlatform::Client.session_key_for_token)
2022-08-13 15:12:31 +05:30
redirect_to project_google_cloud_configuration_path(project), redirect_message
2022-05-07 20:08:51 +05:30
end
end