Ejemplo n.º 1
0
    def authenticate(self, profile=None, **kwargs):

        try:

            config = from_file(profile_name=profile)
            compartment_id = config["tenancy"]

            # Get the current user
            identity = IdentityClient(config)
            identity.get_user(config["user"]).data

            return OracleCredentials(config, compartment_id)

        except Exception as e:
            raise AuthenticationException(e)
Ejemplo n.º 2
0
    def authenticate(self, profile=None, **kwargs):

        try:

            # Set logging level to error for libraries as otherwise generates a lot of warnings
            logging.getLogger('oci').setLevel(logging.ERROR)

            config = from_file(profile_name=profile)

            # Get the current user
            identity = IdentityClient(config)
            identity.get_user(config["user"]).data

            return OracleCredentials(config)

        except Exception as e:
            raise AuthenticationException(e)