當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。