@CheckForNull public String getPassword() { if (password == null) { return null; } try { return PasswordUtil.decodePassword(password); } catch (NumberFormatException e) { return null; } }
public Builder setPassword(@Nullable String password) { if (password != null) { this.password = PasswordUtil.encodePassword(password); } else { this.password = ""; } return this; }
@NotNull public String getSerializedPassword() { if (myAnonymous) return ""; if (myStorePassword) { return PasswordUtil.encodePassword(myPassword); } else { return ""; } }
public void setSerializedPassword(String serializedPassword) { if (!StringUtil.isEmpty(serializedPassword)) { myPassword = PasswordUtil.decodePassword(serializedPassword); myStorePassword = true; } else { myPassword = null; } }
@NotNull public String getSerializedPassphrase() { if (myStorePassphrase) { return PasswordUtil.encodePassword(myPassphrase); } else { return ""; } }
public void setSerializedPassphrase(String serializedPassphrase) { if (!StringUtil.isEmpty(serializedPassphrase)) { myPassphrase = PasswordUtil.decodePassword(serializedPassphrase); myStorePassphrase = true; } else { myPassphrase = null; myStorePassphrase = false; } }
@SuppressWarnings("unused") public void setEncodedToken(@Nullable String token) { try { myToken = PasswordUtil.decodePassword(token); } catch (NumberFormatException ignored) { } }
public void setEncodedPassword(String password) { try { setPassword(PasswordUtil.decodePassword(password)); } catch (NumberFormatException e) { // do nothing } }
public void setEncodedToken(String password) { try { setToken(PasswordUtil.decodePassword(password)); } catch (NumberFormatException e) { LOG.warn("Can't decode token", e); } }
public String getSerializedPassword() { if (myAnonymous) return ""; if (myStorePassword) { return PasswordUtil.encodePassword(myPassword); } else { return ""; } }
@Nullable public String getSerializedPassphrase() { if (myStorePassphrase) { return PasswordUtil.encodePassword(myPassphrase); } else { return ""; } }
public void setEncodedPassword(String password) { try { setPassword(PasswordUtil.decodePassword(password)); } catch(NumberFormatException e) { // do nothing } }
@Nonnull public String getSerializedPassword() { if (myAnonymous) return ""; if (myStorePassword) { return PasswordUtil.encodePassword(myPassword); } else { return ""; } }
@Nonnull public String getSerializedPassphrase() { if (myStorePassphrase) { return PasswordUtil.encodePassword(myPassphrase); } else { return ""; } }
@Tag("token") @NotNull public String getEncodedToken() { // The same approach as used for passwords in BaseRepository return PasswordUtil.encodePassword(myToken); }
@Tag("password") public String getEncodedPassword() { return PasswordUtil.encodePassword(getPassword()); }
@Tag("token") public String getEncodedToken() { return PasswordUtil.encodePassword(getToken()); }
@Nullable @Tag(value = "password") public String getEncodedPassword() { return myStorePassword && myPassword != null ? PasswordUtil.encodePassword(myPassword) : null; }
public void setEncodedPassword(String encodedPassword) { myPassword = encodedPassword != null ? PasswordUtil.decodePassword(encodedPassword) : null; myStorePassword = true; }