internal val LOG = Logger.getInstance(BuiltInWebServer::class.java)
+// name is duplicated in the ConfigImportHelper
+private const val IDE_TOKEN_FILE = "user.token"
+
class BuiltInWebServer : HttpRequestHandler() {
override fun isAccessible(request: HttpRequest) = request.isLocalOrigin(onlyAnyOrLoopback = false, hostsOnly = true)
}
}
-const val TOKEN_PARAM_NAME = "__ij-st"
+internal const val TOKEN_PARAM_NAME = "__ij-st"
private val STANDARD_COOKIE by lazy {
val productName = ApplicationNamesInfo.getInstance().lowercaseProductName
val configPath = PathManager.getConfigPath()
- val cookieName = productName + "-" + Integer.toHexString(configPath.hashCode())
- val file = File(configPath, cookieName)
+ val file = File(configPath, IDE_TOKEN_FILE)
var token: String? = null
if (file.exists()) {
try {
// explicit setting domain cookie on localhost doesn't work for chrome
// http://stackoverflow.com/questions/8134384/chrome-doesnt-create-cookie-for-domain-localhost-in-broken-https
- val cookie = DefaultCookie(cookieName, token!!)
+ val cookie = DefaultCookie(productName + "-" + Integer.toHexString(configPath.hashCode()), token!!)
cookie.isHttpOnly = true
cookie.setMaxAge(TimeUnit.DAYS.toSeconds(365 * 10))
cookie.setPath("/")
/*
- * Copyright 2000-2015 JetBrains s.r.o.
+ * Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// Copy old plugins. If some of them are incompatible PluginManager will deal with it
FileUtil.copyDir(src, dest);
+ // delete old user token - we must not reuse it
+ FileUtil.delete(new File(dest, "user.token"));
+
File oldPluginsDir = new File(src, PLUGINS_PATH);
if (!oldPluginsDir.isDirectory() && SystemInfo.isMac) {
oldPluginsDir = getSettingsPath(oldInstallationHome, settings, PathManager.PROPERTY_PLUGINS_PATH,
}
if (bundle.containsKey(propertyName)) {
return bundle.getString(propertyName);
- }
+ }
return null;
}
catch (IOException e) {
return null;
}
}
-
+
final String fileContent = getContent(file);
// try to find custom config path