public GithubWebhookAuthenticator(String username, String password) { this.correctCredentials = new BasicCredentials(username, password); }
return new BasicCredentials(username, password);
@Override public AuthenticationResult<Account> authenticate(UpgradeRequest request) throws AuthenticationException { try { Map<String, List<String>> parameters = request.getParameterMap(); List<String> usernames = parameters.get("login"); List<String> passwords = parameters.get("password"); if (usernames == null || usernames.size() == 0 || passwords == null || passwords.size() == 0) { return new AuthenticationResult<>(Optional.empty(), false); } BasicCredentials credentials = new BasicCredentials(usernames.get(0).replace(" ", "+"), passwords.get(0).replace(" ", "+")); return new AuthenticationResult<>(accountAuthenticator.authenticate(credentials), true); } catch (io.dropwizard.auth.AuthenticationException e) { throw new AuthenticationException(e); } }
BasicCredentials creds = new BasicCredentials("username", "password"); JiraClient jira = new JiraClient("https://url", creds); try { File file1 = new File("D:\\image1.jpg"); File file2 = new File("D:\\description.pdf"); List<File> fileList = new ArrayList<File>(); fileList.add(file1); fileList.add(file2); Issue newIssue = jira.createIssue("ProjectName", "Task") .field(Field.SUMMARY, "Task with attachments") .field(Field.DESCRIPTION, "Description for task with attachments.") .field(Field.PRIORITY, Field.valueById("2")) .execute(); newIssue.addAttachment(file1); newIssue.addAttachment(file2); } catch (JiraException e) { e.printStackTrace(); }
return new BasicCredentials(username, password);
@PropertySource("classpath:AwsCredentials.properties") public class AWSConfiguration { @Autowired private Environment env; @Bean public AwsCredentials credentials() { String secretKey = env.getRequiredProperty("name of property"); String accessKey = env.getRequiredProperty("name of property"); return new BasicCredentials(accessKey, secretKey); } }
@Override public Result check() throws AuthenticationException { if (ldapAuthenticator.authenticate(new BasicCredentials("", "")).isPresent()) { return Result.healthy(); } else { return Result.unhealthy("Cannot contact authentication service"); } } }
@Override public AuthenticationResult<HelloAccount> authenticate(UpgradeRequest request) throws AuthenticationException { try { Map<String, List<String>> parameters = request.getParameterMap(); List<String> usernames = parameters.get("login"); List<String> passwords = parameters.get("password"); if (usernames == null || usernames.size() == 0 || passwords == null || passwords.size() == 0) { return new AuthenticationResult<>(Optional.empty(), false); } BasicCredentials credentials = new BasicCredentials(usernames.get(0), passwords.get(0)); return new AuthenticationResult<>(basicAuthenticator.authenticate(credentials), true); } catch (io.dropwizard.auth.AuthenticationException e) { throw new AuthenticationException(e); } }
final String username = decoded.substring(0, i); final String password = decoded.substring(i + 1); final BasicCredentials credentials = new BasicCredentials(username, password); try { final Optional<P> principal = authenticator.authenticate(credentials);
AuthorizationPolicy policy = message.get(AuthorizationPolicy.class); if (policy != null) { credentials = new BasicCredentials(policy.getUserName(), policy.getPassword()); } else { if (token != null && token.getTokenType() == TokenType.UsernameToken) { UsernameToken ut = (UsernameToken)token; credentials = new BasicCredentials(ut.getName(), ut.getPassword()); new BasicCredentials(credentials.getUsername(), credentials.getPassword()));