当前位置: 首页>>代码示例>>Java>>正文


Java InvalidSshKeyException类代码示例

本文整理汇总了Java中com.google.gerrit.common.errors.InvalidSshKeyException的典型用法代码示例。如果您正苦于以下问题:Java InvalidSshKeyException类的具体用法?Java InvalidSshKeyException怎么用?Java InvalidSshKeyException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


InvalidSshKeyException类属于com.google.gerrit.common.errors包,在下文中一共展示了InvalidSshKeyException类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addKey

import com.google.gerrit.common.errors.InvalidSshKeyException; //导入依赖的package包/类
public synchronized AccountSshKey addKey(Account.Id accountId, String pub)
    throws IOException, ConfigInvalidException, InvalidSshKeyException {
  VersionedAuthorizedKeys authorizedKeys = read(accountId);
  AccountSshKey key = authorizedKeys.addKey(pub);
  commit(authorizedKeys);
  return key;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:8,代码来源:VersionedAuthorizedKeys.java

示例2: createBatchUserIfNotExistsYet

import com.google.gerrit.common.errors.InvalidSshKeyException; //导入依赖的package包/类
private void createBatchUserIfNotExistsYet() {
	try (ReviewDb db = schema.open()) {
		List<Account> accounts = db.accounts().anyAccounts().toList();
		if (accounts.isEmpty()) {
			logger.info("Cannot create batch user account. No admin user yet. Log in as admin user to Gerrit.");
			executor.schedule(this::createBatchUserIfNotExistsYet, 2, TimeUnit.SECONDS);
			return;
		}

		RequestContext oldContext = null;

		try {
			oldContext = context.setContext(new RequestContext() {
				@Override
				public CurrentUser getUser() {
					return userFactory.create(accounts.iterator().next().getId());
				}

				@Override
				public Provider<ReviewDb> getReviewDbProvider() {
					return () -> db;
				}
			});

			AccountExternalId.Key accountKey = new AccountExternalId.Key(AccountExternalId.SCHEME_USERNAME, username);
			AccountExternalId accountExternalId = db.accountExternalIds().get(accountKey);

			if (accountExternalId == null) {
				accountExternalId = createBatchUser(db);
				logger.info("Batch user account created");
			}

			authorizedKeys.addKey(accountExternalId.getAccountId(), sshKey);
			sshKeyCache.evict(username);
		} finally {
			if (oldContext != null) {
				context.setContext(oldContext);
			}
		}
	} catch (OrmException | IOException | ConfigInvalidException | InvalidSshKeyException e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:atteo,项目名称:jfactory,代码行数:44,代码来源:CreateBatchUser.java

示例3: create

import com.google.gerrit.common.errors.InvalidSshKeyException; //导入依赖的package包/类
@Override
public AccountSshKey create(AccountSshKey.Id id, String encoded) throws InvalidSshKeyException {
  throw new InvalidSshKeyException();
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:5,代码来源:NoSshKeyCache.java

示例4: create

import com.google.gerrit.common.errors.InvalidSshKeyException; //导入依赖的package包/类
AccountSshKey create(AccountSshKey.Id id, String encoded) throws InvalidSshKeyException; 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:2,代码来源:SshKeyCreator.java


注:本文中的com.google.gerrit.common.errors.InvalidSshKeyException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。