本文整理汇总了C++中Credential::certificates方法的典型用法代码示例。如果您正苦于以下问题:C++ Credential::certificates方法的具体用法?C++ Credential::certificates怎么用?C++ Credential::certificates使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Credential
的用法示例。
在下文中一共展示了Credential::certificates方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Credential::Credential(const Credential& original, CredentialPersistence persistence)
: m_user(original.user())
, m_password(original.password())
, m_persistence(persistence)
#if CERTIFICATE_CREDENTIALS_SUPPORTED
, m_identity(original.identity())
, m_certificates(original.certificates())
, m_type(original.type())
#endif
{
}
示例2: ASSERT
bool operator==(const Credential& a, const Credential& b)
{
// Check persistence first since all credential types
// have the persistence property.
if (a.persistence() != b.persistence())
return false;
#if CERTIFICATE_CREDENTIALS_SUPPORTED
CredentialType aType = a.type();
if (aType != b.type())
return false;
// Comparing identity and certificate chain pointers is valid only
// for client certificate type credentials.
//
// FIXME: Is pointer comparison of the identity and certificates properties sufficient?
if (aType == CredentialTypeClientCertificate) {
if (a.identity() != b.identity())
return false;
if (a.certificates() != b.certificates())
return false;
// We only need to check identity and certificates to compare
// client certificate based credentials.
return true;
}
ASSERT(a.type() == CredentialTypePassword && b.type() == CredentialTypePassword);
#endif
if (a.user() != b.user())
return false;
if (a.password() != b.password())
return false;
return true;
}
示例3: createCF
CFURLCredentialRef createCF(const Credential& coreCredential)
{
CFURLCredentialPersistence persistence = kCFURLCredentialPersistenceNone;
switch (coreCredential.persistence()) {
case CredentialPersistenceNone:
break;
case CredentialPersistenceForSession:
persistence = kCFURLCredentialPersistenceForSession;
break;
case CredentialPersistencePermanent:
persistence = kCFURLCredentialPersistencePermanent;
break;
default:
ASSERT_NOT_REACHED();
}
#if CERTIFICATE_CREDENTIALS_SUPPORTED
if (coreCredential.type() == CredentialTypeClientCertificate)
return CFURLCredentialCreateWithIdentityAndCertificateArray(kCFAllocatorDefault, coreCredential.identity(), coreCredential.certificates(), persistence);
#endif
CFStringRef user = coreCredential.user().createCFString();
CFStringRef password = coreCredential.password().createCFString();
CFURLCredentialRef result = CFURLCredentialCreate(0, user, password, 0, persistence);
CFRelease(user);
CFRelease(password);
return result;
}