Class: GithubAuthentication::GitCredentialHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/github_authentication/git_credential_helper.rb

Instance Method Summary collapse

Constructor Details

#initialize(pem:, installation_id:, app_id:, description:, storage: nil) ⇒ GitCredentialHelper

Returns a new instance of GitCredentialHelper.



5
6
7
8
9
10
11
# File 'lib/github_authentication/git_credential_helper.rb', line 5

def initialize(pem:, installation_id:, app_id:, description:, storage: nil)
  @pem = pem
  @installation_id = installation_id
  @app_id = app_id
  @description = description
  @storage = storage
end

Instance Method Details

#handle_getObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/github_authentication/git_credential_helper.rb', line 13

def handle_get
  unless @description["protocol"] == "https" && @description["host"] == "github.com"
    warn("Unsupported description: #{@description}")
    return 2
  end

  token = provider.token(seconds_ttl: min_cache_ttl)
  puts("password=#{token}")
  puts("username=api")

  0
end