use of com.oxygenxml.git.options.PersonalAccessTokenInfo in project oxygen-git-client-addon by oxygenxml.
the class AuthUtil method getCredentialsProvider.
/**
* Get the credentials provider for the given host.
*
* @param host The host.
*
* @return The credentials provider.
*/
public static SSHCapableUserCredentialsProvider getCredentialsProvider(String host) {
CredentialsBase credentials = OptionsManager.getInstance().getGitCredentials(host);
CredentialsType credentialsType = credentials.getType();
return new SSHCapableUserCredentialsProvider(credentialsType == CredentialsType.USER_AND_PASSWORD ? ((UserAndPasswordCredentials) credentials).getUsername() : ((PersonalAccessTokenInfo) credentials).getTokenValue(), credentialsType == CredentialsType.USER_AND_PASSWORD ? ((UserAndPasswordCredentials) credentials).getPassword() : ((PersonalAccessTokenInfo) credentials).getTokenValue(), OptionsManager.getInstance().getSshPassphrase(), credentials.getHost());
}
use of com.oxygenxml.git.options.PersonalAccessTokenInfo in project oxygen-git-client-addon by oxygenxml.
the class LoginDialog method doOK.
@Override
protected void doOK() {
if (basicAuthRadio.isSelected()) {
String username = tfUsername.getText().trim();
String password = new String(pfPassword.getPassword());
credentials = new UserAndPasswordCredentials(username, password, host);
} else {
String tokenValue = new String(tokenPassField.getPassword());
credentials = new PersonalAccessTokenInfo(host, tokenValue);
}
OptionsManager.getInstance().saveGitCredentials(credentials);
super.doOK();
}
Aggregations