Class: UffizziCore::Amazon::CredentialService

Inherits:
Object
  • Object
show all
Defined in:
app/services/uffizzi_core/amazon/credential_service.rb

Class Method Summary collapse

Class Method Details

.access_token(credential) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'app/services/uffizzi_core/amazon/credential_service.rb', line 9

def access_token(credential)
  response = client(credential).authorization_token
  base64_data = response.authorization_data[0].authorization_token
  token_string = Base64.decode64(base64_data)
  token_items = token_string.split(':')
  token_items.pop
rescue Aws::ECR::Errors::UnrecognizedClientException, Aws::ECR::Errors::InvalidSignatureException
  ''
end

.credential_correct?(credential) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'app/services/uffizzi_core/amazon/credential_service.rb', line 5

def credential_correct?(credential)
  access_token(credential).present?
end