本文整理汇总了Java中org.netbeans.api.keyring.Keyring.delete方法的典型用法代码示例。如果您正苦于以下问题:Java Keyring.delete方法的具体用法?Java Keyring.delete怎么用?Java Keyring.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.api.keyring.Keyring
的用法示例。
在下文中一共展示了Keyring.delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAdminPassword
import org.netbeans.api.keyring.Keyring; //导入方法依赖的package包/类
public synchronized void setAdminPassword(String adminPassword) {
// 'null' is a valid password, but if we save as null
// it will actually clear the property. So convert it to
// an empty string.
if ( adminPassword == null ) {
adminPassword = "";
}
// Cache password for this session whether we save it or not.
this.adminPassword = adminPassword;
if ( isSavePassword() ) {
LOGGER.log(Level.FINE, "Storing a Admin Password to Keyring.");
Keyring.save(MySQLOptions.class.getName(), adminPassword.toCharArray(), NbBundle.getMessage(MySQLOptions.class, "MySQLOptions_AdminPassword")); // NOI18N
} else {
LOGGER.log(Level.FINE, "Removing a Admin Password from Keyring.");
Keyring.delete(MySQLOptions.class.getName());
}
}
示例2: save
import org.netbeans.api.keyring.Keyring; //导入方法依赖的package包/类
/**
* Saves password for a key constructed from keyPrefix and key
* @param keyPrefix key prefix for each versioning system
* @param key will be hashed and used with keyPrefix as a key for the keyring
* @param password password, value will be nulled. If <code>null</code> the old record will be permanently deleted
* @param description can be null
*/
public static void save (String keyPrefix, String key, char[] password, String description) {
String hashedKey = getKeyringKeyHashed(keyPrefix, key);
if (password == null) {
if (LOG.isLoggable(Level.FINE)) {
LOG.log(Level.FINE, "Deleting password for {0}:{1}", new String[] {keyPrefix, key}); //NOI18N
}
Keyring.delete(getKeyringKey(keyPrefix, key));
Keyring.delete(hashedKey);
NULL_HASHED_RECORDS.add(hashedKey);
} else {
if (description == null) {
description = key;
}
if (LOG.isLoggable(Level.FINE)) {
LOG.log(Level.FINE, "Saving password for {0}:{1}", new String[] {keyPrefix, key}); //NOI18N
if (PRINT_PASSWORDS) {
LOG.log(Level.FINEST, "Saving password: \"{0}\"", new String(password)); //NOI18N
}
}
Keyring.save(getKeyringKey(keyPrefix, key), password, description);
Keyring.delete(hashedKey);
NULL_HASHED_RECORDS.remove(hashedKey);
}
}
示例3: storeSettings
import org.netbeans.api.keyring.Keyring; //导入方法依赖的package包/类
public void storeSettings() {
if (rememberPasswd.isSelected()) {
Keyring.save(hash + KEY_STORE_PASSWORD, keystorePassword.getPassword(), "NBANDROID Project Keystore Password");
Keyring.save(hash + KEY_PASSWORD, keyPassword.getPassword(), "NBANDROID Project Keystore Key Password");
} else {
Keyring.delete(hash + KEY_STORE_PASSWORD);
Keyring.delete(hash + KEY_PASSWORD);
}
NbPreferences.forModule(KeystoreSelector.class).put(hash + KEY_STORE_PATH, path.getText());
NbPreferences.forModule(KeystoreSelector.class).put(hash + KEY_ALIAS, alias.getText());
NbPreferences.forModule(KeystoreSelector.class).putBoolean(hash + APK_V1, v1.isSelected());
NbPreferences.forModule(KeystoreSelector.class).putBoolean(hash + APK_V2, v2.isSelected());
NbPreferences.forModule(KeystoreSelector.class).putBoolean(hash + APK_RELEASE, release.isSelected());
NbPreferences.forModule(KeystoreSelector.class).putBoolean(hash + APK_DEBUG, debug.isSelected());
NbPreferences.forModule(KeystoreSelector.class).putBoolean(hash + REMEMBER_PASSWORDS, rememberPasswd.isSelected());
}
示例4: saveNBPassword
import org.netbeans.api.keyring.Keyring; //导入方法依赖的package包/类
/**
* Saves the given value as a netbeans.org password
* Shouldn't be called in awt
* @param password
*/
public static void saveNBPassword(char[] password) {
if(password == null) {
Keyring.delete(NB_BUGZILLA_PASSWORD);
} else {
Keyring.save(
NB_BUGZILLA_PASSWORD,
password,
NbBundle.getMessage(
NBBugzillaUtils.class,
"NBRepositorySupport.password_keyring_description")); // NOI18N
}
}
示例5: migrateRecord
import org.netbeans.api.keyring.Keyring; //导入方法依赖的package包/类
private static char[] migrateRecord (String keyPrefix, String key) {
String hashedKey = getKeyringKeyHashed(keyPrefix, key);
if (NULL_HASHED_RECORDS.contains(hashedKey)) {
return null;
}
char[] password = Keyring.read(hashedKey);
if (password != null) {
String fullKey = getKeyringKey(keyPrefix, key);
Keyring.save(fullKey, password.clone(), fullKey);
Keyring.delete(hashedKey);
}
// the record is not present, do not try to migrate next time
NULL_HASHED_RECORDS.add(hashedKey);
return password;
}
示例6: setUp
import org.netbeans.api.keyring.Keyring; //导入方法依赖的package包/类
@Override
protected void setUp () throws Exception {
super.setUp();
prefix = "myvcs_uri_password";
key = "https://[email protected]/path/to/repository.repo";
Keyring.delete(KeyringSupport.getKeyringKeyHashed(prefix, key));
Keyring.delete(KeyringSupport.getKeyringKey(prefix, key));
}
示例7: put
import org.netbeans.api.keyring.Keyring; //导入方法依赖的package包/类
/**
* Update password in memory. If user selected "remember password" option
* before password is updated in Keyring.
*
* @param execEnv
* @param password
*/
private void put(ExecutionEnvironment execEnv, char[] password) {
String key = ExecutionEnvironmentFactory.toUniqueID(execEnv);
if (keepPasswordsInMemory) {
char[] old;
if (password != null) {
old = cache.put(key, Arrays.copyOf(password, password.length));
Logger.getInstance().log(Level.FINEST, "PasswordManager.put({0}, non-null) stored password in memory", execEnv); // NOI18N
} else {
Logger.getInstance().log(Level.FINEST, "PasswordManager.put({0}, null) cleared password from memory", execEnv); // NOI18N
old = cache.put(key, null);
}
if (old != null) {
Arrays.fill(old, 'x');
}
}
boolean store = NbPreferences.forModule(PasswordManager.class).getBoolean(STORE_PREFIX + key, false);
if (store) {
keyringIsActivated = true;
if (password == null) {
Keyring.delete(KEY_PREFIX + key);
} else {
Keyring.save(KEY_PREFIX + key, password,
NbBundle.getMessage(PasswordManager.class, "PasswordManagerPasswordFor", execEnv.getDisplayName())); // NOI18N
}
Logger.getInstance().log(Level.FINEST, "PasswordManager.put({0}, non-null) stored password in keyring", execEnv); // NOI18N
}
}
示例8: clearPassword
import org.netbeans.api.keyring.Keyring; //导入方法依赖的package包/类
/**
* Remove password from memory and Keyring
*
* @param execEnv
*/
public void clearPassword(ExecutionEnvironment execEnv) {
String key = ExecutionEnvironmentFactory.toUniqueID(execEnv);
if (keepPasswordsInMemory) {
cache.remove(key);
}
NbPreferences.forModule(PasswordManager.class).remove(STORE_PREFIX + key);
if (keyringIsActivated) {
Keyring.delete(KEY_PREFIX + key);
}
Logger.getInstance().log(Level.FINEST, "PasswordManager.clearPassword({0})", execEnv); // NOI18N
}
示例9: forceClearPassword
import org.netbeans.api.keyring.Keyring; //导入方法依赖的package包/类
/**
* Remove password from memory and Keyring
*
* @param execEnv
*/
public void forceClearPassword(ExecutionEnvironment execEnv) {
String key = ExecutionEnvironmentFactory.toUniqueID(execEnv);
if (keepPasswordsInMemory) {
cache.remove(key);
}
NbPreferences.forModule(PasswordManager.class).remove(STORE_PREFIX + key);
Keyring.delete(KEY_PREFIX + key);
Logger.getInstance().log(Level.FINEST, "PasswordManager.forceClearPassword({0})", execEnv); // NOI18N
}
示例10: setRememberPassword
import org.netbeans.api.keyring.Keyring; //导入方法依赖的package包/类
/**
* Store user intention of "remember password"
*
* @param execEnv
* @param rememberPassword
*/
public void setRememberPassword(ExecutionEnvironment execEnv, boolean rememberPassword) {
String key = ExecutionEnvironmentFactory.toUniqueID(execEnv);
if (!rememberPassword) {
if (keyringIsActivated) {
Keyring.delete(KEY_PREFIX + key);
}
}
NbPreferences.forModule(PasswordManager.class).putBoolean(STORE_PREFIX + key, rememberPassword);
}
示例11: savePassword
import org.netbeans.api.keyring.Keyring; //导入方法依赖的package包/类
public static void savePassword(char[] password, String prefix, String user, String url) throws MissingResourceException {
if (password != null && password.length != 0) {
Keyring.save(getPasswordKey(prefix, user, url), password, NbBundle.getMessage(BugtrackingUtil.class, "password_keyring_description", url)); // NOI18N
} else {
Keyring.delete(getPasswordKey(prefix, user, url));
}
}
示例12: deleteProjectCredential
import org.netbeans.api.keyring.Keyring; //导入方法依赖的package包/类
@Override
public void deleteProjectCredential(String projectPath) {
String userNameKey = String.format(KEYRING_TEMPLATE_KEY, projectPath, USER_NAME_KEY);
String passwordKey = String.format(KEYRING_TEMPLATE_KEY, projectPath, PASSWORD_KEY);
String securityTokenKey = String.format(KEYRING_TEMPLATE_KEY, projectPath, SECURITY_TOKEN_KEY);
String loginTypeKey = String.format(KEYRING_TEMPLATE_KEY, projectPath, LOGIN_TYPE_KEY);
Keyring.delete(userNameKey);
Keyring.delete(passwordKey);
Keyring.delete(securityTokenKey);
Keyring.delete(loginTypeKey);
}
示例13: clearAdminPassword
import org.netbeans.api.keyring.Keyring; //导入方法依赖的package包/类
public void clearAdminPassword() {
LOGGER.log(Level.FINE, "Removing a Admin Password from Keyring.");
Keyring.delete(MySQLOptions.class.getName());
}
示例14: clear
import org.netbeans.api.keyring.Keyring; //导入方法依赖的package包/类
static void clear(@NonNull final String antPlatformName) {
Keyring.delete(RemotePlatformProvider.createPropertyName(antPlatformName, PLAT_PROP_AUTH_PASSWD));
}
示例15: deletePassword
import org.netbeans.api.keyring.Keyring; //导入方法依赖的package包/类
public static void deletePassword(final String key) {
Parameters.notNull("key", key);
LOGGER.log(Level.FINE, "Deleting password for {0}", key);
Keyring.delete(key);
}