Beispiel #1
0
    def __refresh_credentials(self):
        _logger.info("Doing credentials refresh.")

        http = Http()

        try:
            self.credentials.refresh(http)
        except:
            raise AuthorizationFailureError("Could not refresh credentials.")

        self.__update_cache(self.credentials)

        _logger.debug("Credentials have been refreshed.")
Beispiel #2
0
    def __refresh_credentials(self):
        self.__log.info("Doing credentials refresh.")

        http = Http()

        try:
            self.credentials.refresh(http)
        except (Exception) as e:
            message = "Could not refresh credentials."
            raise AuthorizationFailureError(message)

        self.__update_cache(self.credentials)

        self.__log.info("Credentials have been refreshed.")
    def get_credentials(self):
        try:
            self.credentials = self.__step2_check_auth_cache()
        except:
            message = "Could not check cache for credentials."

            self.__log.exception(message)
            raise AuthorizationFailureError(message)

        if self.credentials == None:
            message = "No credentials were established from the cache."

            self.__log.exception(message)
            raise AuthorizationFaultError(message)

        return self.credentials
Beispiel #4
0
    def step2_doexchange(self, auth_code):
        # Do exchange.

        _logger.debug("Doing exchange.")
        
        try:
            credentials = self.flow.step2_exchange(auth_code)
        except Exception as e:
            message = ("Could not do auth-exchange (this was either a "\
                       "legitimate error, or the auth-exchange was attempted "\
                       "when not necessary): %s" % (e))

            raise AuthorizationFailureError(message)
        
        _logger.debug("Credentials established.")

        self.__update_cache(credentials)
        self.credentials = credentials
    def __refresh_credentials(self):
        self.__log.info("Doing credentials refresh.")

        http = Http()

        try:
            self.credentials.refresh(http)
        except (Exception) as e:
            message = "Could not refresh credentials."

            self.__log.exception(message)
            raise AuthorizationFailureError(message)

        try:
            self.__update_cache(self.credentials)
        except:
            self.__log.exception("Could not update cache. We've nullified the "
                                 "in-memory credentials.")
            raise

        self.__log.info("Credentials have been refreshed.")
    def step2_doexchange(self, auth_code):
        # Do exchange.

        self.__log.info("Doing exchange.")

        try:
            credentials = self.flow.step2_exchange(auth_code)
        except:
            message = "Could not do auth-exchange (this was either a legitimate" \
                      " error, or the auth-exchange was attempted when not " \
                      "necessary)."

            self.__log.exception(message)
            raise AuthorizationFailureError(message)

        self.__log.info("Credentials established.")

        try:
            self.__update_cache(credentials)
        except:
            self.__log.exception("Could not update cache. Process cancelled.")
            raise

        self.credentials = credentials