本文整理汇总了C++中AuthenticationInfo::getLocalAuthSecret方法的典型用法代码示例。如果您正苦于以下问题:C++ AuthenticationInfo::getLocalAuthSecret方法的具体用法?C++ AuthenticationInfo::getLocalAuthSecret怎么用?C++ AuthenticationInfo::getLocalAuthSecret使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AuthenticationInfo
的用法示例。
在下文中一共展示了AuthenticationInfo::getLocalAuthSecret方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testLocalAuthSuccess
//
// Test local authentication
//
void testLocalAuthSuccess()
{
String authHeader;
AuthenticationManager authManager;
AuthenticationInfo* authInfo = new AuthenticationInfo(true);
// Test valid header
authHeader.append(localHeader);
authHeader.append("\"");
authHeader.append(testUser);
authHeader.append("\"");
String respHeader =
authManager.getPegasusAuthResponseHeader(authHeader, authInfo);
if (verbose) cout << "RespHeader: " << respHeader << endl;
Uint32 startQuote = respHeader.find(0, '"');
PEGASUS_TEST_ASSERT(startQuote != PEG_NOT_FOUND);
Uint32 endQuote = respHeader.find(startQuote + 1, '"');
PEGASUS_TEST_ASSERT(endQuote != PEG_NOT_FOUND);
String filePath = respHeader.subString(
startQuote + 1, (endQuote - startQuote - 1));
PEGASUS_TEST_ASSERT(filePath.size() != 0);
authHeader.clear();
authHeader.append(localHeader);
authHeader.append("\"");
authHeader.append(testUser);
authHeader.append(":");
authHeader.append(filePath);
authHeader.append(":");
authHeader.append(authInfo->getLocalAuthSecret());
authHeader.append("\"");
if (verbose) cout << "Local Resp AuthHeader: " << authHeader << endl;
Boolean authenticated;
// test case looks for success, initialize with failure
AuthenticationStatus authStatus(AUTHSC_UNAUTHORIZED);
authStatus = authManager.performPegasusAuthentication(authHeader, authInfo);
authenticated = authStatus.isSuccess();
//
// remove the auth file created for this user request
//
if (FileSystem::exists(filePath))
{
FileSystem::removeFile(filePath);
}
if (verbose)
{
cout << "Local Authentication of User " + testUser + " returned with: ";
cout << authenticated << endl;
}
delete authInfo;
PEGASUS_TEST_ASSERT(authenticated);
}