|
|
@ -5,19 +5,19 @@ import com.fanruan.workplace.http.HttpServiceMap; |
|
|
|
import com.fanruan.workplace.http.RepositoryManager; |
|
|
|
import com.fanruan.workplace.http.RepositoryManager; |
|
|
|
import com.fanruan.workplace.http.info.Stub; |
|
|
|
import com.fanruan.workplace.http.info.Stub; |
|
|
|
import com.fanruan.workplace.network.RemoteNetworkRepository; |
|
|
|
import com.fanruan.workplace.network.RemoteNetworkRepository; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
import com.fr.workspace.engine.exception.RemoteDesignConnectionException; |
|
|
|
|
|
|
|
import com.fr.workspace.engine.exception.RemoteDesignNoAuthException; |
|
|
|
|
|
|
|
import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; |
|
|
|
|
|
|
|
import com.fr.workspace.server.repository.compatible.register.CompatibleRegister; |
|
|
|
|
|
|
|
import com.fr.workspace.server.repository.connect.FineWorkspaceHttpClient; |
|
|
|
|
|
|
|
import com.fr.decision.webservice.bean.authentication.LoginRequestInfoBean; |
|
|
|
import com.fr.decision.webservice.bean.authentication.LoginRequestInfoBean; |
|
|
|
import com.fr.decision.webservice.bean.authentication.LoginResponseInfoBean; |
|
|
|
import com.fr.decision.webservice.bean.authentication.LoginResponseInfoBean; |
|
|
|
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.workspace.connect.WorkspaceClient; |
|
|
|
import com.fr.workspace.connect.WorkspaceClient; |
|
|
|
import com.fr.workspace.connect.WorkspaceConnection; |
|
|
|
import com.fr.workspace.connect.WorkspaceConnection; |
|
|
|
import com.fr.workspace.connect.WorkspaceConnectionInfo; |
|
|
|
import com.fr.workspace.connect.WorkspaceConnectionInfo; |
|
|
|
import com.fr.workspace.connect.WorkspaceConnector; |
|
|
|
import com.fr.workspace.connect.WorkspaceConnector; |
|
|
|
|
|
|
|
import com.fr.workspace.engine.exception.RemoteDesignConnectionException; |
|
|
|
|
|
|
|
import com.fr.workspace.engine.exception.RemoteDesignNoAuthException; |
|
|
|
|
|
|
|
import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; |
|
|
|
|
|
|
|
import com.fr.workspace.server.repository.authority.RemoteAuthoritySource; |
|
|
|
|
|
|
|
import com.fr.workspace.server.repository.compatible.register.CompatibleRegister; |
|
|
|
|
|
|
|
import com.fr.workspace.server.repository.connect.FineWorkspaceHttpClient; |
|
|
|
|
|
|
|
|
|
|
|
import java.net.InetAddress; |
|
|
|
import java.net.InetAddress; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
@ -72,13 +72,18 @@ public class HttpWorkspaceConnector implements WorkspaceConnector { |
|
|
|
Stub<?> stub = entry.getValue(); |
|
|
|
Stub<?> stub = entry.getValue(); |
|
|
|
stub.clearProxy(); |
|
|
|
stub.clearProxy(); |
|
|
|
} |
|
|
|
} |
|
|
|
LoginResponseInfoBean bean = RemoteAuthorityRepository.getInstance().login(createLoginBean(connectionInfo)); |
|
|
|
Map<String, Object> loginConfigMap = RemoteAuthorityRepository.getInstance().getLoginConfigMap(); |
|
|
|
|
|
|
|
long timeout = Long.parseLong(String.valueOf(loginConfigMap.get(RemoteAuthoritySource.LOGIN_TIMEOUT))); |
|
|
|
|
|
|
|
boolean rememberLogin = (boolean) loginConfigMap.get(RemoteAuthoritySource.SUPPORT_REMEMBER_LOGIN); |
|
|
|
|
|
|
|
LoginResponseInfoBean bean = RemoteAuthorityRepository.getInstance().login(createLoginBean(connectionInfo, rememberLogin)); |
|
|
|
WorkspaceConnection connection = new WorkspaceConnection( |
|
|
|
WorkspaceConnection connection = new WorkspaceConnection( |
|
|
|
UUID.randomUUID().toString(), |
|
|
|
UUID.randomUUID().toString(), |
|
|
|
connectionInfo.getUserName(), |
|
|
|
connectionInfo.getUserName(), |
|
|
|
HttpConstants.AUTHORIZATION_PREFIX + bean.getAccessToken(), |
|
|
|
HttpConstants.AUTHORIZATION_PREFIX + bean.getAccessToken(), |
|
|
|
InetAddress.getLocalHost().getHostAddress()); |
|
|
|
InetAddress.getLocalHost().getHostAddress()); |
|
|
|
client.updateConnection(connection); |
|
|
|
client.updateConnection(connection); |
|
|
|
|
|
|
|
client.setRememberLogin(rememberLogin); |
|
|
|
|
|
|
|
client.setTimeout(timeout); |
|
|
|
try { |
|
|
|
try { |
|
|
|
return RemoteNetworkRepository.getInstance().testConnect(); |
|
|
|
return RemoteNetworkRepository.getInstance().testConnect(); |
|
|
|
} catch (RemoteDesignNoAuthException e) { |
|
|
|
} catch (RemoteDesignNoAuthException e) { |
|
|
@ -88,12 +93,12 @@ public class HttpWorkspaceConnector implements WorkspaceConnector { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private LoginRequestInfoBean createLoginBean(WorkspaceConnectionInfo connectionInfo) { |
|
|
|
private LoginRequestInfoBean createLoginBean(WorkspaceConnectionInfo connectionInfo, boolean rememberLogin) { |
|
|
|
LoginRequestInfoBean bean = new LoginRequestInfoBean(); |
|
|
|
LoginRequestInfoBean bean = new LoginRequestInfoBean(); |
|
|
|
bean.setUsername(connectionInfo.getUserName()); |
|
|
|
bean.setUsername(connectionInfo.getUserName()); |
|
|
|
bean.setPassword(connectionInfo.getPassword()); |
|
|
|
bean.setPassword(connectionInfo.getPassword()); |
|
|
|
bean.setEncrypted(false); |
|
|
|
bean.setEncrypted(false); |
|
|
|
bean.setValidity(-2); |
|
|
|
bean.setValidity(rememberLogin ? -2 : -1); |
|
|
|
return bean; |
|
|
|
return bean; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |