Optional<String> (@Nullable CredentialAttributes credentialAttributes) { return Optional.ofNullable(credentialAttributes) .map(attributes -> PasswordSafe.getInstance().get(attributes)) .map(Credentials::getPasswordAsString); }