Class: Vcsmap::Plugin::GoogleOauth

Inherits:
BasePlugin show all
Defined in:
lib/vcsmap/plugins/google_oauth.rb

Instance Attribute Summary

Attributes inherited from BasePlugin

#search_string

Instance Method Summary collapse

Methods inherited from BasePlugin

#capture_match

Constructor Details

#initializeGoogleOauth

Returns a new instance of GoogleOauth.



4
5
6
7
8
# File 'lib/vcsmap/plugins/google_oauth.rb', line 4

def initialize
  @search_string = 'filename:client_secrets.json+.apps.googleusercontent.com'
  @client_id_regex = /(?:\"|')client_id(?:\"|')\:(?:\ |)(?:\"|')(.*?)(?:\"|')/i
  @client_secret_regex = /(?:\"|')client_secret(?:\"|')\:(?:\ |)(?:\"|')(.*?)(?:\"|')/i
end

Instance Method Details

#credentials(file) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/vcsmap/plugins/google_oauth.rb', line 10

def credentials(file)
  @client_id = capture_match(@client_id_regex, file)
  @client_secret = capture_match(@client_secret_regex, file)
  ['oAuth', @client_id, @client_secret]
rescue NoMethodError
  []
end

#table_headerObject



18
19
20
# File 'lib/vcsmap/plugins/google_oauth.rb', line 18

def table_header
  %w(Protocol client_id client_secret)
end