本文整理汇总了Java中com.cloud.user.User.getSecretKey方法的典型用法代码示例。如果您正苦于以下问题:Java User.getSecretKey方法的具体用法?Java User.getSecretKey怎么用?Java User.getSecretKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.cloud.user.User
的用法示例。
在下文中一共展示了User.getSecretKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCloudIdentifierResponse
import com.cloud.user.User; //导入方法依赖的package包/类
@Override
public ArrayList<String> getCloudIdentifierResponse(final long userId) {
final Account caller = getCaller();
// verify that user exists
User user = _accountMgr.getUserIncludingRemoved(userId);
if (user == null || user.getRemoved() != null) {
final InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find active user of specified id");
ex.addProxyObject(String.valueOf(userId), "userId");
throw ex;
}
// check permissions
_accountMgr.checkAccess(caller, null, true, _accountMgr.getAccount(user.getAccountId()));
String cloudIdentifier = _configDao.getValue("cloud.identifier");
if (cloudIdentifier == null) {
cloudIdentifier = "";
}
String signature = "";
try {
// get the user obj to get his secret key
user = _accountMgr.getActiveUser(userId);
final String secretKey = user.getSecretKey();
final String input = cloudIdentifier;
signature = signRequest(input, secretKey);
} catch (final Exception e) {
s_logger.warn("Exception whilst creating a signature:" + e);
}
final ArrayList<String> cloudParams = new ArrayList<>();
cloudParams.add(cloudIdentifier);
cloudParams.add(signature);
return cloudParams;
}