def test_cc_get_principal(self): self.require(ad_user=True) domain = self.domain().upper() principal = '%s@%s' % (self.ad_user_account(), domain) password = self.ad_user_password() self.acquire_credentials(principal, password) ccache = krb5.cc_default() princ = krb5.cc_get_principal(ccache) assert princ.lower() == principal.lower()
def load(self): """Load credentials from the OS.""" ccache = krb5.cc_default() if not os.access(ccache, os.R_OK): raise Error, 'No ccache found' self.m_principal = krb5.cc_get_principal(ccache) self._init_ccache() krb5.cc_copy_creds(ccache, self.m_ccache) self._activate_ccache() self._resolve_servers_for_domain(self.m_domain)