Example #1
0
    def test_navigator_conf(self):
        resets = [
            NAVIGATOR.AUTH_CM_USERNAME.set_for_testing('cm_username'),
            NAVIGATOR.AUTH_CM_PASSWORD.set_for_testing('cm_pwd'),
            NAVIGATOR.AUTH_LDAP_USERNAME.set_for_testing('ldap_username'),
            NAVIGATOR.AUTH_LDAP_PASSWORD.set_for_testing('ldap_pwd'),
            NAVIGATOR.AUTH_SAML_USERNAME.set_for_testing('saml_username'),
            NAVIGATOR.AUTH_SAML_PASSWORD.set_for_testing('saml_pwd'),
        ]

        reset = NAVIGATOR.AUTH_TYPE.set_for_testing('CMDB')
        conf.NAVIGATOR_AUTH_PASSWORD = None

        try:
            assert_equal('cm_username', get_navigator_auth_username())
            assert_equal('cm_pwd', get_navigator_auth_password())

            reset()
            conf.NAVIGATOR_AUTH_PASSWORD = None
            reset = NAVIGATOR.AUTH_TYPE.set_for_testing('ldap')

            assert_equal('ldap_username', get_navigator_auth_username())
            assert_equal('ldap_pwd', get_navigator_auth_password())

            reset()
            conf.NAVIGATOR_AUTH_PASSWORD = None
            reset = NAVIGATOR.AUTH_TYPE.set_for_testing('SAML')

            assert_equal('saml_username', get_navigator_auth_username())
            assert_equal('saml_pwd', get_navigator_auth_password())
        finally:
            reset()
            conf.NAVIGATOR_AUTH_PASSWORD = None
            for _reset in resets:
                _reset()
Example #2
0
  def __init__(self, user=None):
    self._api_url = '%s/%s' % (NAVIGATOR.API_URL.get().strip('/'), VERSION)
    self._username = get_navigator_auth_username()
    self._password = get_navigator_auth_password()

    self.user = user
    self._client = HttpClient(self._api_url, logger=LOG)
    self._client.set_basic_auth(self._username, self._password)
    self._root = resource.Resource(self._client, urlencode=False) # For search_entities_interactive

    self.__headers = {}
    self.__params = ()
Example #3
0
  def __init__(self, user=None):
    self._api_url = '%s/%s' % (NAVIGATOR.API_URL.get().strip('/'), VERSION)
    self._username = get_navigator_auth_username()
    self._password = get_navigator_auth_password()

    self.user = user
    # Navigator does not support Kerberos authentication while other components usually requires it
    self._client = UnsecureHttpClient(self._api_url, logger=LOG)
    self._client.set_basic_auth(self._username, self._password)
    self._root = resource.Resource(self._client, urlencode=False) # For search_entities_interactive

    self.__headers = {}
    self.__params = ()
Example #4
0
  def __init__(self, user=None, security_enabled=False, ssl_cert_ca_verify=False):
    self._api_url = '%s/%s' % (MANAGER.API_URL.get().strip('/'), VERSION)
    self._username = get_navigator_auth_username()
    self._password = get_navigator_auth_password()

    self.user = user
    self._client = HttpClient(self._api_url, logger=LOG)

    if security_enabled:
      self._client.set_kerberos_auth()
    else:
      self._client.set_basic_auth(self._username, self._password)

    self._client.set_verify(ssl_cert_ca_verify)
    self._root = Resource(self._client)