MCPcopy Index your code
hub / github.com/aws/aws-cli / Credentials

Class Credentials

awscli/botocore/credentials.py:335–380  ·  view source on GitHub ↗

Holds the credentials needed to authenticate requests. :param str access_key: The access key part of the credentials. :param str secret_key: The secret key part of the credentials. :param str token: The security token, valid only for session credentials. :param str method: A st

Source from the content-addressed store, hash-verified

333
334
335class Credentials:
336 """
337 Holds the credentials needed to authenticate requests.
338
339 :param str access_key: The access key part of the credentials.
340 :param str secret_key: The secret key part of the credentials.
341 :param str token: The security token, valid only for session credentials.
342 :param str method: A string which identifies where the credentials
343 were found.
344 :param str account_id: (optional) An account ID associated with the credentials.
345 """
346
347 def __init__(
348 self, access_key, secret_key, token=None, method=None, account_id=None
349 ):
350 self.access_key = access_key
351 self.secret_key = secret_key
352 self.token = token
353
354 if method is None:
355 method = 'explicit'
356 self.method = method
357 self.account_id = account_id
358
359 self._normalize()
360
361 def _normalize(self):
362 # Keys would sometimes (accidentally) contain non-ascii characters.
363 # It would cause a confusing UnicodeDecodeError in Python 2.
364 # We explicitly convert them into unicode to avoid such error.
365 #
366 # Eventually the service will decide whether to accept the credential.
367 # This also complies with the behavior in Python 3.
368 self.access_key = botocore.compat.ensure_unicode(self.access_key)
369 self.secret_key = botocore.compat.ensure_unicode(self.secret_key)
370
371 def get_frozen_credentials(self):
372 return ReadOnlyCredentials(
373 self.access_key, self.secret_key, self.token, self.account_id
374 )
375
376 def get_deferred_property(self, property_name):
377 def get_property():
378 return getattr(self, property_name, None)
379
380 return get_property
381
382
383class RefreshableCredentials(Credentials):

Calls

no outgoing calls