org.eclipse.jgit.transport.CredentialItem Java Examples
The following examples show how to use
org.eclipse.jgit.transport.CredentialItem.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AwsCodeCommitCredentialsProviderTests.java From spring-cloud-config with Apache License 2.0 | 6 votes |
@Test public void testReturnsCredentials() throws URISyntaxException { CredentialItem[] credentialItems = makeCredentialItems(); assertThat(this.provider.get(new URIish(AWS_REPO), credentialItems)).isTrue(); String theUsername = ((CredentialItem.Username) credentialItems[0]).getValue(); char[] thePassword = ((CredentialItem.Password) credentialItems[1]).getValue(); assertThat(theUsername).isEqualTo(USER); assertThat(thePassword).isNotNull(); // The password will always begin with a timestamp like // 20161113T121314Z assertThat(thePassword.length > 16).isTrue(); assertThat(thePassword[8]).isEqualTo('T'); assertThat(thePassword[15]).isEqualTo('Z'); }
Example #2
Source File: GitSkipSslValidationCredentialsProviderTest.java From spring-cloud-config with Apache License 2.0 | 6 votes |
@Test public void testGetSslTrustItems() throws URISyntaxException { URIish uri = new URIish("https://example.com/repo.git"); CredentialItem message = new CredentialItem.InformationalMessage( JGitText.get().sslFailureTrustExplanation); CredentialItem.YesNoType trustNow = new CredentialItem.YesNoType( JGitText.get().sslTrustNow); CredentialItem.YesNoType trustAlways = new CredentialItem.YesNoType( JGitText.get().sslTrustAlways); boolean getSuccessful = this.skipSslValidationCredentialsProvider.get(uri, message, trustNow, trustAlways); assertThat(getSuccessful).as( "SkipSSlValidationCredentialsProvider must successfully get the types required for SSL validation skipping") .isTrue(); assertThat(trustNow.getValue()).as( "SkipSSlValidationCredentialsProvider should trust the current repo operation") .isTrue(); assertThat(trustAlways.getValue()) .as("We should not globally skip all SSL validation").isFalse(); }
Example #3
Source File: GitSkipSslValidationCredentialsProviderTest.java From spring-cloud-config with Apache License 2.0 | 6 votes |
@Test public void testGetUnrelatedCredentialItemTypesWithDelegate() throws URISyntaxException { this.skipSslValidationCredentialsProvider = new GitSkipSslValidationCredentialsProvider( this.mockDelegateCredentialsProvider); URIish uri = new URIish("https://example.com/repo.git"); CredentialItem usernameCredentialItem = new CredentialItem.Username(); CredentialItem passwordCredentialItem = new CredentialItem.Password(); when(this.mockDelegateCredentialsProvider.get(uri, usernameCredentialItem, passwordCredentialItem)).thenReturn(true); boolean getSuccessful = this.skipSslValidationCredentialsProvider.get(uri, usernameCredentialItem, passwordCredentialItem); assertThat(getSuccessful).as("GitSkipSslValidationCredentialsProvider " + "must successfully get the types supported by its delegate CredentialsProvider") .isTrue(); }
Example #4
Source File: GitSkipSslValidationCredentialsProviderTest.java From spring-cloud-config with Apache License 2.0 | 6 votes |
@Test public void testSupportsUnrelatedCredentialItemTypesWithDelegate() { this.skipSslValidationCredentialsProvider = new GitSkipSslValidationCredentialsProvider( this.mockDelegateCredentialsProvider); CredentialItem usernameCredentialItem = new CredentialItem.Username(); when(this.mockDelegateCredentialsProvider.supports(usernameCredentialItem)) .thenReturn(true); boolean supportsItems = this.skipSslValidationCredentialsProvider .supports(usernameCredentialItem); assertThat(supportsItems).as( "GitSkipSslValidationCredentialsProvider must support the types supported by its delegate CredentialsProvider") .isTrue(); }
Example #5
Source File: GitSkipSslValidationCredentialsProviderTest.java From spring-cloud-config with Apache License 2.0 | 6 votes |
@Test public void testSupportsSslValidationYesNoTypes() { CredentialItem yesNoType = new CredentialItem.YesNoType( JGitText.get().sslTrustNow); assertThat(this.skipSslValidationCredentialsProvider.supports(yesNoType)).as( "GitSkipSslValidationCredentialsProvider should always support the trust now YesNoType item") .isTrue(); yesNoType = new CredentialItem.YesNoType( MessageFormat.format(JGitText.get().sslTrustForRepo, "/a/path.git")); assertThat(this.skipSslValidationCredentialsProvider.supports(yesNoType)).as( "GitSkipSslValidationCredentialsProvider should always support the trust repo YesNoType item") .isTrue(); yesNoType = new CredentialItem.YesNoType(JGitText.get().sslTrustAlways); assertThat(this.skipSslValidationCredentialsProvider.supports(yesNoType)).as( "GitSkipSslValidationCredentialsProvider should always support the trust always YesNoType item") .isTrue(); yesNoType = new CredentialItem.YesNoType("unrelated"); assertThat(this.skipSslValidationCredentialsProvider.supports(yesNoType)).as( "GitSkipSslValidationCredentialsProvider should not support unrelated YesNoType items") .isFalse(); }
Example #6
Source File: AwsCodeCommitCredentialsProviderTests.java From spring-cloud-config with Apache License 2.0 | 6 votes |
@Test public void testNotSupportsOther() { assertThat(this.provider.supports( new CredentialItem[] { new CredentialItem.YesNoType("OK To Login?") // this // is // not // ok })).isFalse(); assertThat(this.provider.supports( new CredentialItem[] { new CredentialItem.StringType("OK To Login?", true) // this // is // not // ok })).isFalse(); assertThat(this.provider .supports(new CredentialItem[] { new CredentialItem.Username(), // this // is // ok new CredentialItem.Password(), // this is ok new CredentialItem.StringType("OK To Login?", true) // this is not // ok })).isFalse(); }
Example #7
Source File: AwsCodeCommitCredentialProvider.java From spring-cloud-config with Apache License 2.0 | 6 votes |
/** * We support username and password credential items only. * @see org.eclipse.jgit.transport.CredentialsProvider#supports(org.eclipse.jgit.transport.CredentialItem[]) */ @Override public boolean supports(CredentialItem... items) { for (CredentialItem i : items) { if (i instanceof CredentialItem.Username) { continue; } else if (i instanceof CredentialItem.Password) { continue; } else { return false; } } return true; }
Example #8
Source File: GitOperations.java From spring-data-dev-tools with Apache License 2.0 | 6 votes |
@Override public boolean get(URIish uri, CredentialItem... items) throws UnsupportedCredentialItem { if (!matchesKey(items)) { return false; } for (CredentialItem item : items) { if (item instanceof CharArrayType) { ((CharArrayType) item).setValueNoCopy(gpg.getPassword().toString().toCharArray()); return true; } } return false; }
Example #9
Source File: JGitCredentialsProvider.java From mOrgAnd with GNU General Public License v2.0 | 6 votes |
@Override public boolean get(URIish uri, CredentialItem... items) throws UnsupportedCredentialItem { for (CredentialItem item : items) { if (item instanceof CredentialItem.Username) { ((CredentialItem.Username) item).setValue(username); } else if (item instanceof CredentialItem.Password) { ((CredentialItem.Password) item).setValue(password.toCharArray()); } else if (item instanceof CredentialItem.StringType) { ((CredentialItem.StringType) item).setValue(password); } else if (item instanceof CredentialItem.InformationalMessage) { throw new UnsupportedCredentialItem(uri, "Not supported"); } else if (item instanceof CredentialItem.YesNoType) { // TODO handle strict host key checking here throw new UnsupportedCredentialItem(uri, "Not supported"); } else { throw new UnsupportedCredentialItem(uri, "Not supported"); } } return true; }
Example #10
Source File: SmartCredentialsProvider.java From git-client-plugin with MIT License | 6 votes |
/** {@inheritDoc} */ @Override public synchronized boolean supports(CredentialItem... credentialItems) { items: for (CredentialItem item : credentialItems) { if (supports(defaultCredentials, item)) { continue; } for (StandardCredentials c : specificCredentials.values()) { if (supports(c, item)) { continue items; } } return false; } return true; }
Example #11
Source File: PrivateKeyCredentialsProvider.java From WebIDE-Backend with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public boolean get(URIish uri, CredentialItem... items) throws UnsupportedCredentialItem { for (CredentialItem i : items) { if (i instanceof Identity) { ((Identity) i).setValue(identityFile); continue; } if (i instanceof KnownHosts) { ((KnownHosts) i).setValue(knownHostsFile); continue; } throw new UnsupportedCredentialItem(uri, i.getClass().getName() + ":" + i.getPromptText()); //$NON-NLS-1$ } return true; }
Example #12
Source File: UsernamePasswordCredentialsProvider.java From gerrit-code-review-plugin with Apache License 2.0 | 6 votes |
public UsernamePassword getUsernamePassword(URIish uri) { addDefaultCredentials(credentials); String username = uri.getUser(); String password = uri.getPass(); CredentialItem.Username u = new CredentialItem.Username(); CredentialItem.Password p = new CredentialItem.Password(); if (supports(u, p) && get(uri, u, p)) { username = u.getValue(); char[] v = p.getValue(); password = (v == null) ? null : new String(p.getValue()); p.clear(); } return new UsernamePassword(username, password); }
Example #13
Source File: CredentialsProviderImpl.java From git-client-plugin with MIT License | 6 votes |
/** * {@inheritDoc} * * If username/password is given, use it for HTTP auth. */ @Override public boolean supports(CredentialItem... items) { if (!(cred instanceof StandardUsernamePasswordCredentials)) return false; for (CredentialItem i : items) { if (i instanceof CredentialItem.Username) continue; else if (i instanceof CredentialItem.Password) continue; else return false; } return true; }
Example #14
Source File: SmartCredentialsProviderTest.java From git-client-plugin with MIT License | 6 votes |
@Before public void setUp() { listener = StreamTaskListener.fromStdout(); provider = new SmartCredentialsProvider(listener); username = new CredentialItem.Username(); password = new CredentialItem.Password(); maskedUsername = new StandardUsernameCredentialsCredentialItem(MASKED_USER_NAME_PROMPT, true); unmaskedUsername = new StandardUsernameCredentialsCredentialItem(UNMASKED_USER_NAME_PROMPT, false); maskedStringType = new CredentialItem.StringType(MASKED_STRING_TYPE_PROMPT, true); unmaskedStringType = new CredentialItem.StringType(UNMASKED_STRING_TYPE_PROMPT, false); specialStringType = new CredentialItem.StringType(SPECIAL_STRING_TYPE_PROMPT, false); assertNull(username.getValue()); assertNull(password.getValue()); assertNull(maskedUsername.getValue()); assertNull(unmaskedUsername.getValue()); assertNull(maskedStringType.getValue()); assertNull(unmaskedStringType.getValue()); }
Example #15
Source File: JGitEnvironmentRepositoryTests.java From spring-cloud-config with Apache License 2.0 | 5 votes |
@Test public void gitCredentialsProviderFactoryCreatesSkipSslValidationProvider() throws Exception { Git mockGit = mock(Git.class); MockCloneCommand mockCloneCommand = new MockCloneCommand(mockGit); final String username = "someuser"; final String password = "mypassword"; JGitEnvironmentRepository envRepository = new JGitEnvironmentRepository( this.environment, new JGitEnvironmentProperties()); envRepository.setGitFactory(new MockGitFactory(mockGit, mockCloneCommand)); envRepository.setUri("https://somegitserver/somegitrepo"); envRepository.setBasedir(new File("./mybasedir")); envRepository.setUsername(username); envRepository.setPassword(password); envRepository.setSkipSslValidation(true); envRepository.setCloneOnStart(true); envRepository.afterPropertiesSet(); CredentialsProvider provider = mockCloneCommand.getCredentialsProvider(); assertThat(provider instanceof GitSkipSslValidationCredentialsProvider).isTrue(); CredentialItem.Username usernameCredential = new CredentialItem.Username(); CredentialItem.Password passwordCredential = new CredentialItem.Password(); assertThat(provider.supports(usernameCredential)).isTrue(); assertThat(provider.supports(passwordCredential)).isTrue(); provider.get(new URIish(), usernameCredential); assertThat(username).isEqualTo(usernameCredential.getValue()); provider.get(new URIish(), passwordCredential); assertThat(password).isEqualTo(String.valueOf(passwordCredential.getValue())); }
Example #16
Source File: CredentialsProviderImplTest.java From git-client-plugin with MIT License | 5 votes |
@Test public void testThrowsUnsupportedOperationException() { CredentialItem.InformationalMessage message = new CredentialItem.InformationalMessage("Some info"); assertFalse(provider.supports(message)); assertThrows(UnsupportedCredentialItem.class, () -> { provider.get(uri, message); }); }
Example #17
Source File: GitSkipSslValidationCredentialsProviderTest.java From spring-cloud-config with Apache License 2.0 | 5 votes |
@Test public void testGetSslTrustItemsWithLocalRepo() throws URISyntaxException { URIish uri = new URIish("https://example.com/repo.git"); CredentialItem message = new CredentialItem.InformationalMessage( JGitText.get().sslFailureTrustExplanation); CredentialItem.YesNoType trustNow = new CredentialItem.YesNoType( JGitText.get().sslTrustNow); CredentialItem.YesNoType trustForRepo = new CredentialItem.YesNoType( JGitText.get().sslTrustForRepo); CredentialItem.YesNoType trustAlways = new CredentialItem.YesNoType( JGitText.get().sslTrustAlways); boolean getSuccessful = this.skipSslValidationCredentialsProvider.get(uri, message, trustNow, trustForRepo, trustAlways); assertThat(getSuccessful).as( "SkipSSlValidationCredentialsProvider must successfully get the types required for SSL validation skipping") .isTrue(); assertThat(trustNow.getValue()).as( "SkipSSlValidationCredentialsProvider should trust the current repo operation") .isTrue(); assertThat(trustForRepo.getValue()) .as("Future operations on this repository should also be trusted") .isTrue(); assertThat(trustAlways.getValue()) .as("We should not globally skip all SSL validation").isFalse(); }
Example #18
Source File: CredentialsProviderImplTest.java From git-client-plugin with MIT License | 5 votes |
@Test public void testSpecialStringTypeThrowsException() { CredentialItem.StringType specialStringType = new CredentialItem.StringType("Bad Password: ", false); assertFalse(provider.supports(specialStringType)); assertThrows(UnsupportedCredentialItem.class, () -> { provider.get(uri, specialStringType); }); }
Example #19
Source File: JGitEnvironmentRepositoryTests.java From spring-cloud-config with Apache License 2.0 | 5 votes |
@Test public void usernamePasswordShouldSetCredentials() throws Exception { Git mockGit = mock(Git.class); MockCloneCommand mockCloneCommand = new MockCloneCommand(mockGit); JGitEnvironmentRepository envRepository = new JGitEnvironmentRepository( this.environment, new JGitEnvironmentProperties()); envRepository.setGitFactory(new MockGitFactory(mockGit, mockCloneCommand)); envRepository.setUri("git+ssh://git@somegitserver/somegitrepo"); envRepository.setBasedir(new File("./mybasedir")); final String username = "someuser"; final String password = "mypassword"; envRepository.setUsername(username); envRepository.setPassword(password); envRepository.setCloneOnStart(true); envRepository.afterPropertiesSet(); assertTrue(mockCloneCommand .getCredentialsProvider() instanceof UsernamePasswordCredentialsProvider); CredentialsProvider provider = mockCloneCommand.getCredentialsProvider(); CredentialItem.Username usernameCredential = new CredentialItem.Username(); CredentialItem.Password passwordCredential = new CredentialItem.Password(); assertThat(provider.supports(usernameCredential)).isTrue(); assertThat(provider.supports(passwordCredential)).isTrue(); provider.get(new URIish(), usernameCredential); assertThat(username).isEqualTo(usernameCredential.getValue()); provider.get(new URIish(), passwordCredential); assertThat(password).isEqualTo(String.valueOf(passwordCredential.getValue())); }
Example #20
Source File: CredentialsProviderImplTest.java From git-client-plugin with MIT License | 5 votes |
@Test public void testSupportsSpecialStringType() { CredentialItem.StringType specialStringType = new CredentialItem.StringType("Password: ", false); assertNull(specialStringType.getValue()); /* The supports() method does not know about the "special" StringType * which can be used to return the password plaintext. Passing a * StringType with the prompt text "Password: " will return the plain * text password. */ assertFalse(provider.supports(specialStringType)); assertTrue(provider.get(uri, specialStringType)); assertEquals(SECRET_VALUE, specialStringType.getValue()); }
Example #21
Source File: JGitEnvironmentRepositoryTests.java From spring-cloud-config with Apache License 2.0 | 5 votes |
@Test public void passphraseShouldSetCredentials() throws Exception { final String passphrase = "mypassphrase"; Git mockGit = mock(Git.class); MockCloneCommand mockCloneCommand = new MockCloneCommand(mockGit); JGitEnvironmentRepository envRepository = new JGitEnvironmentRepository( this.environment, new JGitEnvironmentProperties()); envRepository.setGitFactory(new MockGitFactory(mockGit, mockCloneCommand)); envRepository.setUri("git+ssh://git@somegitserver/somegitrepo"); envRepository.setBasedir(new File("./mybasedir")); envRepository.setPassphrase(passphrase); envRepository.setCloneOnStart(true); envRepository.afterPropertiesSet(); assertThat(mockCloneCommand.hasPassphraseCredentialsProvider()).isTrue(); CredentialsProvider provider = mockCloneCommand.getCredentialsProvider(); assertThat(provider.isInteractive()).isFalse(); CredentialItem.StringType stringCredential = new CredentialItem.StringType( PassphraseCredentialsProvider.PROMPT, true); assertThat(provider.supports(stringCredential)).isTrue(); provider.get(new URIish(), stringCredential); assertThat(passphrase).isEqualTo(stringCredential.getValue()); }
Example #22
Source File: JGitEnvironmentRepositoryTests.java From spring-cloud-config with Apache License 2.0 | 5 votes |
@Test public void gitCredentialsProviderFactoryCreatesPassphraseProvider() throws Exception { final String passphrase = "mypassphrase"; final String gitUri = "git+ssh://git@somegitserver/somegitrepo"; Git mockGit = mock(Git.class); MockCloneCommand mockCloneCommand = new MockCloneCommand(mockGit); JGitEnvironmentRepository envRepository = new JGitEnvironmentRepository( this.environment, new JGitEnvironmentProperties()); envRepository.setGitFactory(new MockGitFactory(mockGit, mockCloneCommand)); envRepository.setUri(gitUri); envRepository.setBasedir(new File("./mybasedir")); envRepository.setPassphrase(passphrase); envRepository.setCloneOnStart(true); envRepository.afterPropertiesSet(); assertThat(mockCloneCommand.hasPassphraseCredentialsProvider()).isTrue(); CredentialsProvider provider = mockCloneCommand.getCredentialsProvider(); assertThat(provider.isInteractive()).isFalse(); CredentialItem.StringType stringCredential = new CredentialItem.StringType( PassphraseCredentialsProvider.PROMPT, true); assertThat(provider.supports(stringCredential)).isTrue(); provider.get(new URIish(), stringCredential); assertThat(passphrase).isEqualTo(stringCredential.getValue()); }
Example #23
Source File: JGitEnvironmentRepositoryTests.java From spring-cloud-config with Apache License 2.0 | 5 votes |
@Test public void gitCredentialsProviderFactoryCreatesUsernamePasswordProvider() throws Exception { Git mockGit = mock(Git.class); MockCloneCommand mockCloneCommand = new MockCloneCommand(mockGit); final String username = "someuser"; final String password = "mypassword"; JGitEnvironmentRepository envRepository = new JGitEnvironmentRepository( this.environment, new JGitEnvironmentProperties()); envRepository.setGitFactory(new MockGitFactory(mockGit, mockCloneCommand)); envRepository.setUri("git+ssh://git@somegitserver/somegitrepo"); envRepository.setBasedir(new File("./mybasedir")); envRepository.setUsername(username); envRepository.setPassword(password); envRepository.setCloneOnStart(true); envRepository.afterPropertiesSet(); assertTrue(mockCloneCommand .getCredentialsProvider() instanceof UsernamePasswordCredentialsProvider); CredentialsProvider provider = mockCloneCommand.getCredentialsProvider(); CredentialItem.Username usernameCredential = new CredentialItem.Username(); CredentialItem.Password passwordCredential = new CredentialItem.Password(); assertThat(provider.supports(usernameCredential)).isTrue(); assertThat(provider.supports(passwordCredential)).isTrue(); provider.get(new URIish(), usernameCredential); assertThat(username).isEqualTo(usernameCredential.getValue()); provider.get(new URIish(), passwordCredential); assertThat(password).isEqualTo(String.valueOf(passwordCredential.getValue())); }
Example #24
Source File: SmartCredentialsProvider.java From git-client-plugin with MIT License | 5 votes |
private boolean supports(StandardCredentials c, CredentialItem i) { if (c == null) { return false; } if (i instanceof StandardUsernameCredentialsCredentialItem) { return c instanceof StandardUsernameCredentials; } if (i instanceof CredentialItem.Username) { return c instanceof UsernameCredentials; } if (i instanceof CredentialItem.Password) { return c instanceof PasswordCredentials; } return false; }
Example #25
Source File: CredentialsProviderImplTest.java From git-client-plugin with MIT License | 5 votes |
@Test public void testSupportsPassword() { CredentialItem.Password password = new CredentialItem.Password(); assertNull(password.getValue()); assertTrue(provider.supports(password)); assertTrue(provider.get(uri, password)); assertNotNull(password.getValue()); }
Example #26
Source File: CredentialsProviderImplTest.java From git-client-plugin with MIT License | 5 votes |
@Test public void testSupportsUsername() { CredentialItem.Username username = new CredentialItem.Username(); assertNull(username.getValue()); assertTrue(provider.supports(username)); assertTrue(provider.get(uri, username)); assertEquals(USER_NAME, username.getValue()); }
Example #27
Source File: AwsCodeCommitCredentialsProviderTests.java From spring-cloud-config with Apache License 2.0 | 5 votes |
@Test public void testUriWithCurlyBracesReturnsTrue() throws UnsupportedCredentialItem, URISyntaxException { GitCredentialsProviderFactory factory = new GitCredentialsProviderFactory(); this.provider = (AwsCodeCommitCredentialProvider) factory .createFor(CURLY_BRACES_REPO, USER, PASSWORD, null, false); CredentialItem[] credentialItems = makeCredentialItems(); assertThat(this.provider.get(new URIish(CURLY_BRACES_REPO), credentialItems)) .isTrue(); }
Example #28
Source File: AwsCodeCommitCredentialsProviderTests.java From spring-cloud-config with Apache License 2.0 | 5 votes |
@Test public void testThrowsUnsupportedCredentialException() throws URISyntaxException { CredentialItem[] goodCredentialItems = makeCredentialItems(); CredentialItem[] badCredentialItems = new CredentialItem[] { goodCredentialItems[0], goodCredentialItems[1], new CredentialItem.YesNoType("OK?") }; try { this.provider.get(new URIish(AWS_REPO), badCredentialItems); fail("Expected UnsupportedCredentialItem exception"); } catch (UnsupportedCredentialItem e) { assertThat(e.getMessage()).isNotNull(); } }
Example #29
Source File: CredentialsProviderImplTest.java From git-client-plugin with MIT License | 5 votes |
@Test public void testSupportsDisallowed() { Secret secret = Secret.fromString(SECRET_VALUE); listener = StreamTaskListener.fromStdout(); StandardUsernameCredentials badCred = new MyUsernameCredentialsImpl(USER_NAME); CredentialsProviderImpl badProvider = new CredentialsProviderImpl(listener, badCred); CredentialItem.Username username = new CredentialItem.Username(); assertNull(username.getValue()); assertFalse(badProvider.supports(username)); assertFalse(badProvider.get(uri, username)); assertNull(username.getValue()); }
Example #30
Source File: CredentialsProviderImpl.java From git-client-plugin with MIT License | 5 votes |
/** * {@inheritDoc} * * If username/password is given, use it for HTTP auth. */ @Override public boolean get(URIish uri, CredentialItem... items) throws UnsupportedCredentialItem { if (!(cred instanceof StandardUsernamePasswordCredentials)) return false; StandardUsernamePasswordCredentials _cred = (StandardUsernamePasswordCredentials) cred; for (CredentialItem i : items) { if (i instanceof CredentialItem.Username) { ((CredentialItem.Username) i).setValue(_cred.getUsername()); continue; } if (i instanceof CredentialItem.Password) { ((CredentialItem.Password) i).setValue( _cred.getPassword().getPlainText().toCharArray()); continue; } if (i instanceof CredentialItem.StringType) { if (i.getPromptText().equals("Password: ")) { ((CredentialItem.StringType) i).setValue( _cred.getPassword().getPlainText()); continue; } } throw new UnsupportedCredentialItem(uri, i.getClass().getName() + ":" + i.getPromptText()); } return true; }