private void configureCommand(TransportCommand<?, ?> command) { command.setTimeout(this.timeout); if (this.transportConfigCallback != null) { command.setTransportConfigCallback(this.transportConfigCallback); } CredentialsProvider credentialsProvider = getCredentialsProvider(); if (credentialsProvider != null) { command.setCredentialsProvider(credentialsProvider); } }
@Override protected <T extends TransportCommand> T buildCommand(T command) { command.setCredentialsProvider(usernameProvider); return command; } }
/** * <p>Constructor for TransportCommand.</p> * * @param repo a {@link org.eclipse.jgit.lib.Repository} object. */ protected TransportCommand(Repository repo) { super(repo); setCredentialsProvider(CredentialsProvider.getDefault()); }
/** * Configure a child command with the current configuration set in * {@code this} command * * @param childCommand * a {@link org.eclipse.jgit.api.TransportCommand} object. * @return {@code this} */ protected C configure(TransportCommand childCommand) { childCommand.setCredentialsProvider(credentialsProvider); childCommand.setTimeout(timeout); childCommand.setTransportConfigCallback(transportConfigCallback); return self(); } }
private void setCredentialsProvider(TransportCommand<?, ?> cmd) { if (gitCredentialsProvider != null) { cmd.setCredentialsProvider(gitCredentialsProvider); } else if (hasText(username)) { cmd.setCredentialsProvider(new UsernamePasswordCredentialsProvider(username, password)); } else if (hasText(passphrase)) { cmd.setCredentialsProvider(new PassphraseCredentialsProvider(passphrase)); } }
/** * @param repo */ protected TransportCommand(final Repository repo) { super(repo); setCredentialsProvider(CredentialsProvider.getDefault()); }
private static void setCredentials(TransportCommand<?, ?> command, String username, String password) { if (StringUtils.isNotBlank(username)) { if (password == null) { // If an user accessing a GitHub repository through HTTPS with an OAuth access token password = ""; } command.setCredentialsProvider(new UsernamePasswordCredentialsProvider(username, password)); } }
/** * <p>Constructor for TransportCommand.</p> * * @param repo a {@link org.eclipse.jgit.lib.Repository} object. */ protected TransportCommand(Repository repo) { super(repo); setCredentialsProvider(CredentialsProvider.getDefault()); }
protected void setCredentials(TransportCommand command) { String username = mRepo.getUsername(); String password = mRepo.getPassword(); if (username != null && password != null && !username.trim().isEmpty() && !password.trim().isEmpty()) { UsernamePasswordCredentialsProvider auth = new UsernamePasswordCredentialsProvider( username, password); command.setCredentialsProvider(auth); } else { Timber.d("no CredentialsProvider when no username/password provided"); } }
private static <T extends TransportCommand<?, ?>> void configureHttp(T cmd, PasswordMirrorCredential cred) { cmd.setCredentialsProvider(new UsernamePasswordCredentialsProvider(cred.username(), cred.password())); }
/** * Configure a child command with the current configuration set in * {@code this} command * * @param childCommand * a {@link org.eclipse.jgit.api.TransportCommand} object. * @return {@code this} */ protected C configure(TransportCommand childCommand) { childCommand.setCredentialsProvider(credentialsProvider); childCommand.setTimeout(timeout); childCommand.setTransportConfigCallback(transportConfigCallback); return self(); } }
/** * Configure a child command with the current configuration set in * {@code this} command * * @param childCommand * @return {@code this} */ protected C configure(final TransportCommand childCommand) { childCommand.setCredentialsProvider(credentialsProvider); childCommand.setTimeout(timeout); childCommand.setTransportConfigCallback(transportConfigCallback); return self(); } }
private static <T extends TransportCommand<?, ?>> void configureHttp(T cmd, PasswordMirrorCredential cred) { cmd.setCredentialsProvider(new UsernamePasswordCredentialsProvider(cred.username(), cred.password())); }
private static <T extends TransportCommand<?, ?>> void configureHttp(T cmd, PasswordMirrorCredential cred) { cmd.setCredentialsProvider(new UsernamePasswordCredentialsProvider(cred.username(), cred.password())); }
/** * Configures the transport of the command to deal with things like SSH */ public static <C extends GitCommand> void configureCommand(TransportCommand<C, ?> command, UserDetails userDetails) { configureCommand(command, userDetails.createCredentialsProvider(), userDetails.getSshPrivateKey(), userDetails.getSshPublicKey()); command.setCredentialsProvider(userDetails.createCredentialsProvider()); }
/** * Configures the transport of the command to deal with things like SSH */ public static <C extends GitCommand> void configureCommand(TransportCommand<C, ?> command, UserDetails userDetails) { configureCommand(command, userDetails.createCredentialsProvider(), userDetails.getSshPrivateKey(), userDetails.getSshPublicKey()); command.setCredentialsProvider(userDetails.createCredentialsProvider()); }