Package com.gitblit.transport.ssh

Examples of com.gitblit.transport.ssh.IPublicKeyManager


      GitBlitSuite.stopGitblit();
    }
  }

  protected MemoryKeyManager getKeyManager() {
    IPublicKeyManager mgr = gitblit().getPublicKeyManager();
    if (mgr instanceof MemoryKeyManager) {
      return (MemoryKeyManager) gitblit().getPublicKeyManager();
    } else {
      throw new RuntimeException("unexpected key manager type " + mgr.getClass().getName());
    }
  }
View Full Code Here


    @Option(name = "-L", usage = "list complete public key parameters")
    private boolean showRaw;

    @Override
    public void run() {
      IPublicKeyManager keyManager = getContext().getGitblit().getPublicKeyManager();
      String username = getContext().getClient().getUsername();
      List<SshKey> keys = keyManager.getKeys(username);

      if (showRaw) {
        asRaw(keys);
      } else {
        asTable(keys);
View Full Code Here

    private List<String> values = new ArrayList<String>();

    @Override
    public void run() throws Failure {
      final String username = getContext().getClient().getUsername();
      IPublicKeyManager keyManager = getContext().getGitblit().getPublicKeyManager();
      List<SshKey> keys = keyManager.getKeys(username);
      if (index > keys.size()) {
        throw new UnloggedFailure(1"Invalid key index!");
      }

      String comment = Joiner.on(" ").join(values);
      SshKey key = keys.get(index - 1);
      key.setComment(comment);
      if (keyManager.addKey(username, key)) {
        stdout.println(String.format("Updated the comment for key #%d.", index));
      } else {
        throw new Failure(1, String.format("Failed to update the comment for key #%d!", index));
      }
    }
View Full Code Here

    private String value;

    @Override
    public void run() throws Failure {
      final String username = getContext().getClient().getUsername();
      IPublicKeyManager keyManager = getContext().getGitblit().getPublicKeyManager();
      List<SshKey> keys = keyManager.getKeys(username);
      if (index > keys.size()) {
        throw new UnloggedFailure(1"Invalid key index!");
      }

      SshKey key = keys.get(index - 1);
      AccessPermission permission = AccessPermission.fromCode(value);
      if (permission.exceeds(AccessPermission.NONE)) {
        try {
          key.setPermission(permission);
        } catch (IllegalArgumentException e) {
          throw new Failure(1, e.getMessage());
        }
      }
      if (keyManager.addKey(username, key)) {
        stdout.println(String.format("Updated the permission for key #%d.", index));
      } else {
        throw new Failure(1, String.format("Failed to update the comment for key #%d!", index));
      }
    }
View Full Code Here

TOP

Related Classes of com.gitblit.transport.ssh.IPublicKeyManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.