Compare commits
9 Commits
patch/TPS-
...
release/8.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c57d0ba772 | ||
|
|
b390f938c8 | ||
|
|
c9d5fda28b | ||
|
|
4a04edee4a | ||
|
|
2047bf8b13 | ||
|
|
96fc7eb574 | ||
|
|
7d361371d2 | ||
|
|
4e0527d80c | ||
|
|
e0eb2d5356 |
@@ -96,7 +96,9 @@ public class EclipseCommandLine {
|
||||
static public final String PROP_KEY_PROFILE_ID = "eclipse.p2.profile";
|
||||
|
||||
static public final String ARG_BRANCH = "-branch";
|
||||
|
||||
|
||||
static public final String ARG_PROJECT = "-project";
|
||||
|
||||
static public final String LOGIN_ONLINE_UPDATE = "--loginOnlineUpdate";
|
||||
|
||||
static public final String ARG_TALEND_BUNDLES_CLEANED = "-talend.studio.bundles.cleaned"; //$NON-NLS-1$
|
||||
|
||||
@@ -1,125 +1,127 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.repository.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.workbench.extensions.ExtensionImplementationProvider;
|
||||
import org.talend.commons.utils.workbench.extensions.ExtensionPointLimiterImpl;
|
||||
import org.talend.commons.utils.workbench.extensions.IExtensionPointLimiter;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
|
||||
/**
|
||||
* Provides, using extension points, implementation of many factories.
|
||||
*
|
||||
* <ul>
|
||||
* <li>IProcessFactory</li>
|
||||
* </ul>
|
||||
*
|
||||
* $Id: RepositoryFactoryProvider.java 38013 2010-03-05 14:21:59Z mhirt $
|
||||
*/
|
||||
public class RepositoryFactoryProvider {
|
||||
|
||||
private static List<IRepositoryFactory> list = null;
|
||||
|
||||
public static final IExtensionPointLimiter REPOSITORY_PROVIDER = new ExtensionPointLimiterImpl(
|
||||
"org.talend.core.repository.repository_provider", //$NON-NLS-1$
|
||||
"RepositoryFactory", 1, -1); //$NON-NLS-1$
|
||||
|
||||
public static List<IRepositoryFactory> getAvailableRepositories() {
|
||||
if (list == null) {
|
||||
list = new ArrayList<IRepositoryFactory>();
|
||||
List<IConfigurationElement> extension = ExtensionImplementationProvider.getInstanceV2(REPOSITORY_PROVIDER);
|
||||
String hiddenRepos = System.getProperty("hidden.repositories"); //$NON-NLS-1$
|
||||
String hiddenRepository[] = new String[]{};
|
||||
if (hiddenRepos != null) {
|
||||
hiddenRepository = hiddenRepos.split(";"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
boolean isPoweredByTalend = false;
|
||||
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault()
|
||||
.getService(IBrandingService.class);
|
||||
isPoweredByTalend = brandingService.isPoweredbyTalend();
|
||||
for (IConfigurationElement current : extension) {
|
||||
try {
|
||||
String only4TalendStr = current.getAttribute("only4Talend"); //$NON-NLS-1$
|
||||
if (Boolean.valueOf(only4TalendStr) && !isPoweredByTalend) {
|
||||
continue;
|
||||
}
|
||||
String only4OemStr = current.getAttribute("only4Oem"); //$NON-NLS-1$
|
||||
if (Boolean.valueOf(only4OemStr) && isPoweredByTalend) {
|
||||
continue;
|
||||
}
|
||||
IRepositoryFactory currentAction = (IRepositoryFactory) current.createExecutableExtension("class"); //$NON-NLS-1$
|
||||
currentAction.setId(current.getAttribute("id")); //$NON-NLS-1$
|
||||
currentAction.setName(current.getAttribute("name")); //$NON-NLS-1$
|
||||
currentAction.setAuthenticationNeeded(new Boolean(current.getAttribute("authenticationNeeded"))); //$NON-NLS-1$
|
||||
currentAction.setDisplayToUser(new Boolean(current.getAttribute("displayToUser")).booleanValue()); //$NON-NLS-1$
|
||||
|
||||
// Getting dynamic login fields:
|
||||
for (IConfigurationElement currentLoginField : current.getChildren("loginField")) { //$NON-NLS-1$
|
||||
DynamicFieldBean key = new DynamicFieldBean(currentLoginField.getAttribute("id"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("name"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("defaultValue"), //$NON-NLS-1$
|
||||
new Boolean(currentLoginField.getAttribute("required")), //$NON-NLS-1$
|
||||
new Boolean(currentLoginField.getAttribute("password")), //$NON-NLS-1$
|
||||
Boolean.valueOf(currentLoginField.getAttribute("readonly"))); //$NON-NLS-1$
|
||||
currentAction.getFields().add(key);
|
||||
}
|
||||
|
||||
for (IConfigurationElement currentLoginField : current.getChildren("button")) { //$NON-NLS-1$
|
||||
DynamicButtonBean key = new DynamicButtonBean(currentLoginField.getAttribute("id"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("name"), //$NON-NLS-1$
|
||||
(SelectionListener) currentLoginField.createExecutableExtension("selectionListener")); //$NON-NLS-1$
|
||||
currentAction.getButtons().add(key);
|
||||
}
|
||||
|
||||
for (IConfigurationElement currentLoginField : current.getChildren("choiceField")) { //$NON-NLS-1$
|
||||
DynamicChoiceBean key = new DynamicChoiceBean(currentLoginField.getAttribute("id"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("name")); //$NON-NLS-1$
|
||||
for (IConfigurationElement currentChoice : currentLoginField.getChildren("choice")) { //$NON-NLS-1$
|
||||
String value = currentChoice.getAttribute("value"); //$NON-NLS-1$
|
||||
String label = currentChoice.getAttribute("label"); //$NON-NLS-1$
|
||||
key.addChoice(value, label);
|
||||
}
|
||||
currentAction.getChoices().add(key);
|
||||
}
|
||||
if (ArrayUtils.contains(hiddenRepository, currentAction.getId())) {
|
||||
continue;
|
||||
}
|
||||
list.add(currentAction);
|
||||
} catch (CoreException e) {
|
||||
// e.printStackTrace();
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static IRepositoryFactory getRepositoriyById(String id) {
|
||||
for (IRepositoryFactory current : getAvailableRepositories()) {
|
||||
if (current.getId().equals(id)) {
|
||||
return current;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.repository.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
import org.talend.commons.CommonsPlugin;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.workbench.extensions.ExtensionImplementationProvider;
|
||||
import org.talend.commons.utils.workbench.extensions.ExtensionPointLimiterImpl;
|
||||
import org.talend.commons.utils.workbench.extensions.IExtensionPointLimiter;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
|
||||
/**
|
||||
* Provides, using extension points, implementation of many factories.
|
||||
*
|
||||
* <ul>
|
||||
* <li>IProcessFactory</li>
|
||||
* </ul>
|
||||
*
|
||||
* $Id: RepositoryFactoryProvider.java 38013 2010-03-05 14:21:59Z mhirt $
|
||||
*/
|
||||
public class RepositoryFactoryProvider {
|
||||
|
||||
private static List<IRepositoryFactory> list = null;
|
||||
|
||||
public static final IExtensionPointLimiter REPOSITORY_PROVIDER = new ExtensionPointLimiterImpl(
|
||||
"org.talend.core.repository.repository_provider", //$NON-NLS-1$
|
||||
"RepositoryFactory", 1, -1); //$NON-NLS-1$
|
||||
|
||||
public static synchronized List<IRepositoryFactory> getAvailableRepositories() {
|
||||
if (list == null) {
|
||||
list = new ArrayList<IRepositoryFactory>();
|
||||
List<IConfigurationElement> extension = ExtensionImplementationProvider.getInstanceV2(REPOSITORY_PROVIDER);
|
||||
String hiddenRepos = System.getProperty("hidden.repositories"); //$NON-NLS-1$
|
||||
String hiddenRepository[] = new String[]{};
|
||||
if (hiddenRepos != null) {
|
||||
hiddenRepository = hiddenRepos.split(";"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
boolean isPoweredByTalend = false;
|
||||
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault()
|
||||
.getService(IBrandingService.class);
|
||||
isPoweredByTalend = brandingService.isPoweredbyTalend();
|
||||
for (IConfigurationElement current : extension) {
|
||||
try {
|
||||
String only4TalendStr = current.getAttribute("only4Talend"); //$NON-NLS-1$
|
||||
if (Boolean.valueOf(only4TalendStr) && !isPoweredByTalend) {
|
||||
continue;
|
||||
}
|
||||
String only4OemStr = current.getAttribute("only4Oem"); //$NON-NLS-1$
|
||||
if (Boolean.valueOf(only4OemStr) && isPoweredByTalend) {
|
||||
continue;
|
||||
}
|
||||
IRepositoryFactory currentAction = (IRepositoryFactory) current.createExecutableExtension("class"); //$NON-NLS-1$
|
||||
currentAction.setId(current.getAttribute("id")); //$NON-NLS-1$
|
||||
currentAction.setName(current.getAttribute("name")); //$NON-NLS-1$
|
||||
currentAction.setAuthenticationNeeded(new Boolean(current.getAttribute("authenticationNeeded"))); //$NON-NLS-1$
|
||||
currentAction.setDisplayToUser(new Boolean(current.getAttribute("displayToUser")).booleanValue()); //$NON-NLS-1$
|
||||
|
||||
// Getting dynamic login fields:
|
||||
for (IConfigurationElement currentLoginField : current.getChildren("loginField")) { //$NON-NLS-1$
|
||||
DynamicFieldBean key = new DynamicFieldBean(currentLoginField.getAttribute("id"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("name"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("defaultValue"), //$NON-NLS-1$
|
||||
new Boolean(currentLoginField.getAttribute("required")), //$NON-NLS-1$
|
||||
new Boolean(currentLoginField.getAttribute("password")), //$NON-NLS-1$
|
||||
Boolean.valueOf(currentLoginField.getAttribute("readonly"))); //$NON-NLS-1$
|
||||
currentAction.getFields().add(key);
|
||||
}
|
||||
|
||||
for (IConfigurationElement currentLoginField : current.getChildren("button")) { //$NON-NLS-1$
|
||||
DynamicButtonBean key = new DynamicButtonBean(currentLoginField.getAttribute("id"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("name"), //$NON-NLS-1$
|
||||
(SelectionListener) currentLoginField.createExecutableExtension("selectionListener")); //$NON-NLS-1$
|
||||
currentAction.getButtons().add(key);
|
||||
}
|
||||
|
||||
for (IConfigurationElement currentLoginField : current.getChildren("choiceField")) { //$NON-NLS-1$
|
||||
DynamicChoiceBean key = new DynamicChoiceBean(currentLoginField.getAttribute("id"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("name")); //$NON-NLS-1$
|
||||
for (IConfigurationElement currentChoice : currentLoginField.getChildren("choice")) { //$NON-NLS-1$
|
||||
String value = currentChoice.getAttribute("value"); //$NON-NLS-1$
|
||||
String label = currentChoice.getAttribute("label"); //$NON-NLS-1$
|
||||
key.addChoice(value, label);
|
||||
}
|
||||
currentAction.getChoices().add(key);
|
||||
}
|
||||
if (ArrayUtils.contains(hiddenRepository, currentAction.getId())) {
|
||||
continue;
|
||||
}
|
||||
list.add(currentAction);
|
||||
} catch (CoreException e) {
|
||||
// e.printStackTrace();
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static IRepositoryFactory getRepositoriyById(String id) {
|
||||
for (IRepositoryFactory current : getAvailableRepositories()) {
|
||||
if (current.getId().equals(id)) {
|
||||
return current;
|
||||
}
|
||||
}
|
||||
ExceptionHandler.log("Can't find repository factory for: " + id);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,8 @@ Require-Bundle: org.eclipse.jdt.core,
|
||||
jackson-core-asl,
|
||||
org.talend.libraries.jackson,
|
||||
org.eclipse.m2e.core,
|
||||
org.talend.libraries.apache.common
|
||||
org.talend.libraries.apache.common,
|
||||
org.talend.signon.util
|
||||
Bundle-Activator: org.talend.core.runtime.CoreRuntimePlugin
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: .,
|
||||
|
||||
@@ -15,8 +15,10 @@ package org.talend.core.context;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.properties.User;
|
||||
import org.talend.core.service.ICloudSignOnService;
|
||||
|
||||
/**
|
||||
* DOC smallet class global comment. Detailled comment <br/>
|
||||
@@ -139,6 +141,14 @@ public class RepositoryContext {
|
||||
* @return the clearPassword
|
||||
*/
|
||||
public String getClearPassword() {
|
||||
try {
|
||||
if (ICloudSignOnService.get() != null && ICloudSignOnService.get().isSignViaCloud()) {
|
||||
return ICloudSignOnService.get().getLatestToken().getAccessToken();
|
||||
}
|
||||
}catch (Exception ex) {
|
||||
ExceptionHandler.process(ex);
|
||||
}
|
||||
|
||||
return clearPassword;
|
||||
}
|
||||
|
||||
|
||||
@@ -147,8 +147,15 @@ public enum EDatabaseTypeName {
|
||||
|
||||
MAPRDB(
|
||||
"MapRDB", "MapRDB", Boolean.FALSE, "MAPRDB", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Column_Family, true),//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
SNOWFLAKE(
|
||||
"SNOWFLAKE","SNOWFLAKE",Boolean.TRUE,"SNOWFLAKE",EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.None);
|
||||
"SNOWFLAKE",
|
||||
"SNOWFLAKE",
|
||||
Boolean.TRUE,
|
||||
"SNOWFLAKE",
|
||||
EDatabaseSchemaOrCatalogMapping.None,
|
||||
EDatabaseSchemaOrCatalogMapping.None,
|
||||
true);
|
||||
|
||||
// displayName is used in Java code.
|
||||
private String displayName;
|
||||
|
||||
@@ -17,10 +17,14 @@ import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.pendo.PendoTrackSender;
|
||||
import org.talend.core.runtime.i18n.Messages;
|
||||
import org.talend.repository.model.RepositoryConstants;
|
||||
import org.talend.signon.util.TMCRepositoryUtil;
|
||||
import org.talend.signon.util.TokenMode;
|
||||
import org.talend.utils.json.JSONException;
|
||||
import org.talend.utils.json.JSONObject;
|
||||
|
||||
@@ -58,12 +62,14 @@ public class ConnectionBean implements Cloneable {
|
||||
|
||||
private static final String TOKEN = "token"; //$NON-NLS-1$
|
||||
|
||||
private static final String URL = "url"; //$NON-NLS-1$
|
||||
|
||||
private static final String STORECREDENTIALS = "storeCredentials"; //$NON-NLS-1$
|
||||
|
||||
private String credentials = ""; //$NON-NLS-1$
|
||||
|
||||
public static final String CLOUD_TOKEN_ID ="cloud_token"; //$NON-NLS-1$
|
||||
|
||||
private static final String LOGIN_VIA_CLOUD = "login_via_cloud"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* DOC smallet ConnectionBean constructor comment.
|
||||
*/
|
||||
@@ -89,6 +95,24 @@ public class ConnectionBean implements Cloneable {
|
||||
newConnection.setPassword(""); //$NON-NLS-1$
|
||||
return newConnection;
|
||||
}
|
||||
|
||||
public static ConnectionBean getDefaultCloudConnectionBean(String dataCenter) {
|
||||
ConnectionBean newConnection = new ConnectionBean();
|
||||
newConnection.setName(Messages.getString("ConnectionBean.Cloud.name", TMCRepositoryUtil.getDisplayNameByDatacenter(dataCenter))); //$NON-NLS-1$
|
||||
newConnection.setDescription(Messages.getString("ConnectionBean.CloudConnection.description", TMCRepositoryUtil.getDisplayNameByDatacenter(dataCenter))); //$NON-NLS-1$
|
||||
newConnection.setRepositoryId(TMCRepositoryUtil.getRepositoryId(dataCenter));
|
||||
newConnection.setToken(true);
|
||||
newConnection.setStoreCredentials(true);
|
||||
newConnection.setComplete(true);
|
||||
newConnection.setLoginViaCloud(true);
|
||||
newConnection.setWorkSpace(getRecentWorkSpace());
|
||||
return newConnection;
|
||||
}
|
||||
|
||||
protected static String getRecentWorkSpace() {
|
||||
String filePath = new Path(Platform.getInstanceLocation().getURL().getPath()).toFile().getPath();
|
||||
return filePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for ID.
|
||||
@@ -184,11 +208,16 @@ public class ConnectionBean implements Cloneable {
|
||||
*/
|
||||
public String getPassword() {
|
||||
try {
|
||||
|
||||
if (conDetails.has(PASSWORD)) {
|
||||
if (isStoreCredentials() && credentials != null) {
|
||||
return this.credentials;
|
||||
}
|
||||
return conDetails.getString(PASSWORD);
|
||||
} else if (conDetails.has(CLOUD_TOKEN_ID)){
|
||||
String object = conDetails.getString(CLOUD_TOKEN_ID);
|
||||
TokenMode token = TokenMode.parseFromJson(object, null);
|
||||
return token.getAccessToken();
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
@@ -215,7 +244,7 @@ public class ConnectionBean implements Cloneable {
|
||||
* @return the user
|
||||
*/
|
||||
public String getUser() {
|
||||
try {
|
||||
try {
|
||||
if (conDetails.has(USER)) {
|
||||
String user = conDetails.getString(USER);
|
||||
if (isToken()) {
|
||||
@@ -226,7 +255,7 @@ public class ConnectionBean implements Cloneable {
|
||||
}
|
||||
}
|
||||
return user;
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
@@ -320,6 +349,25 @@ public class ConnectionBean implements Cloneable {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLoginViaCloud() {
|
||||
try {
|
||||
if (conDetails.has(LOGIN_VIA_CLOUD)) {
|
||||
return (Boolean) conDetails.get(LOGIN_VIA_CLOUD);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
// do nothing
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setLoginViaCloud(boolean isLoginViaCloud) {
|
||||
try {
|
||||
conDetails.put(LOGIN_VIA_CLOUD, isLoginViaCloud);
|
||||
} catch (JSONException e) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConnectionBean clone() throws CloneNotSupportedException {
|
||||
@@ -418,14 +466,21 @@ public class ConnectionBean implements Cloneable {
|
||||
|
||||
public String getUrl() {
|
||||
try {
|
||||
if (conDetails.has(URL)) {
|
||||
return conDetails.getString(URL);
|
||||
if (dynamicFields.containsKey(RepositoryConstants.REPOSITORY_URL)) {
|
||||
return dynamicFields.get(RepositoryConstants.REPOSITORY_URL);
|
||||
}
|
||||
if (conDetails.has(RepositoryConstants.REPOSITORY_URL)) {
|
||||
return conDetails.getString(RepositoryConstants.REPOSITORY_URL);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
dynamicFields.put(RepositoryConstants.REPOSITORY_URL, url);
|
||||
}
|
||||
|
||||
public boolean isStoreCredentials() {
|
||||
try {
|
||||
@@ -453,4 +508,27 @@ public class ConnectionBean implements Cloneable {
|
||||
public void setCredentials(String credentials) {
|
||||
this.credentials = credentials;
|
||||
}
|
||||
|
||||
|
||||
public TokenMode getConnectionToken() {
|
||||
try {
|
||||
if (conDetails.has(CLOUD_TOKEN_ID)) {
|
||||
String object = conDetails.getString(CLOUD_TOKEN_ID);
|
||||
return TokenMode.parseFromJson(object, null);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void setConnectionToken(TokenMode connectionToken) {
|
||||
try {
|
||||
conDetails.put(CLOUD_TOKEN_ID, TokenMode.writeToJson(connectionToken));
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,10 @@ public class SparkBatchMetadataTalendTypeFilter extends SparkMetadataTalendTypeF
|
||||
"tFileInputParquet",
|
||||
"tFileOutputParquet",
|
||||
"tJDBCInput",
|
||||
"tJDBCOutput", "tLogRow", "tSqlRow"
|
||||
"tJDBCOutput",
|
||||
"tLogRow",
|
||||
"tSqlRow",
|
||||
"tFileInputDelimited"
|
||||
);
|
||||
|
||||
public SparkBatchMetadataTalendTypeFilter(INode node) {
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.properties.ProjectReference;
|
||||
import org.talend.core.pendo.properties.IPendoDataProperties;
|
||||
import org.talend.core.pendo.properties.PendoLoginProperties;
|
||||
import org.talend.core.service.ICloudSignOnService;
|
||||
import org.talend.core.service.IStudioLiteP2Service;
|
||||
import org.talend.core.ui.IInstalledPatchService;
|
||||
import org.talend.repository.ProjectManager;
|
||||
@@ -81,6 +82,10 @@ public class PendoTrackDataUtil {
|
||||
loginEvent.setEnabledFeatures(enabledFeatures);
|
||||
}
|
||||
setUpRefProjectsStructure(loginEvent);
|
||||
loginEvent.setIsOneClickLogin(Boolean.FALSE.toString());
|
||||
if (ICloudSignOnService.get() != null && ICloudSignOnService.get().isSignViaCloud()) {
|
||||
loginEvent.setIsOneClickLogin(Boolean.TRUE.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,9 @@ public class PendoLoginProperties implements IPendoDataProperties {
|
||||
@JsonProperty("referenced_projects")
|
||||
private List<String> refProjectList;
|
||||
|
||||
@JsonProperty("one_click_login")
|
||||
private String isOneClickLogin;
|
||||
|
||||
/**
|
||||
* Getter for studio_version.
|
||||
*
|
||||
@@ -126,4 +129,22 @@ public class PendoLoginProperties implements IPendoDataProperties {
|
||||
this.refProjectList = refProjectList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for isOneClickLogin.
|
||||
*
|
||||
* @return the isOneClickLogin
|
||||
*/
|
||||
public String getIsOneClickLogin() {
|
||||
return isOneClickLogin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the isOneClickLogin.
|
||||
*
|
||||
* @param isOneClickLogin the isOneClickLogin to set
|
||||
*/
|
||||
public void setIsOneClickLogin(String isOneClickLogin) {
|
||||
this.isOneClickLogin = isOneClickLogin;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -552,6 +552,8 @@ BusinessAppearanceComposite.textAlignment.vertical.centre=Centre
|
||||
ConnectionBean.Local=Local
|
||||
ConnectionBean.Remote=Remote
|
||||
ConnectionBean.DefaultConnection=Default connection
|
||||
ConnectionBean.Cloud.name=Signed in: Cloud ({0})
|
||||
ConnectionBean.CloudConnection.description=Remote connection to Cloud - Signed in: Cloud ({0})
|
||||
InegerCellEditorListener.NegativeNumberMessage=The value of {0} can't be set by negative number.
|
||||
InegerCellEditorListener.NumeralMessage=The value of {0} should be numeral.
|
||||
OpenXSDFileDialog.cancel=Cancel
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.service;
|
||||
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.IService;
|
||||
import org.talend.signon.util.TokenMode;
|
||||
import org.talend.signon.util.listener.LoginEventListener;
|
||||
|
||||
public interface ICloudSignOnService extends IService {
|
||||
|
||||
TokenMode getToken(String authCode, String codeVerifier, String dataCenter) throws Exception;
|
||||
|
||||
void startHeartBeat() throws Exception;
|
||||
|
||||
void stopHeartBeat();
|
||||
|
||||
String generateCodeVerifier();
|
||||
|
||||
String getCodeChallenge(String seed) throws Exception;
|
||||
|
||||
boolean hasValidToken() throws Exception;
|
||||
|
||||
String getTokenUser(String url, TokenMode token) throws Exception;
|
||||
|
||||
void signonCloud(LoginEventListener listener) throws Exception;
|
||||
|
||||
TokenMode getLatestToken() throws Exception;
|
||||
|
||||
public boolean refreshToken() throws Exception;
|
||||
|
||||
boolean isSignViaCloud();
|
||||
|
||||
boolean isNeedShowSSOPage();
|
||||
|
||||
public void showReloginDialog();
|
||||
|
||||
public boolean isReloginDialogRunning();
|
||||
|
||||
public void reload();
|
||||
|
||||
public static ICloudSignOnService get() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICloudSignOnService.class)) {
|
||||
return GlobalServiceRegister.getDefault().getService(ICloudSignOnService.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.model.general.ConnectionBean;
|
||||
import org.talend.core.service.ICloudSignOnService;
|
||||
import org.talend.utils.json.JSONArray;
|
||||
import org.talend.utils.json.JSONException;
|
||||
import org.talend.utils.json.JSONObject;
|
||||
@@ -158,6 +159,8 @@ public class ConnectionUserPerReader {
|
||||
}
|
||||
if (cons == null || cons.size() == 0) {
|
||||
proper.remove("connection.users");//$NON-NLS-1$
|
||||
proper.remove("connection.define");//$NON-NLS-1$
|
||||
proper.remove("connection.lastConnection");//$NON-NLS-1$
|
||||
} else {
|
||||
JSONArray usersJsonArray = new JSONArray();
|
||||
for (ConnectionBean currentConnection : cons) {
|
||||
@@ -207,7 +210,6 @@ public class ConnectionUserPerReader {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void createPropertyFile() {
|
||||
|
||||
@@ -1,86 +1,103 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.prefs;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import org.talend.commons.i18n.MessagesCore;
|
||||
|
||||
/**
|
||||
* Use to retrieve general application parameters.<br/>
|
||||
*
|
||||
* $Id: Messages.java 1 2006-09-29 17:06:40 +0000 (ven., 29 sept. 2006) nrousseau $
|
||||
*
|
||||
*/
|
||||
public class GeneralParametersProvider extends MessagesCore {
|
||||
|
||||
private static final String BUNDLE_NAME = "parameters"; //$NON-NLS-1$
|
||||
|
||||
private static final String PLUGIN_ID = "org.talend.core"; //$NON-NLS-1$
|
||||
|
||||
private static ResourceBundle resourceBundle;
|
||||
|
||||
private static ResourceBundle getBundle() {
|
||||
if (resourceBundle == null) {
|
||||
try {
|
||||
resourceBundle = ResourceBundle.getBundle(BUNDLE_NAME);
|
||||
} catch (Exception e) {
|
||||
// Nothing to do (return null)
|
||||
}
|
||||
}
|
||||
return resourceBundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value corresponding to the specified key.
|
||||
*/
|
||||
public static String getString(GeneralParameters key) {
|
||||
return getString(key.getParamName(), PLUGIN_ID, getBundle());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sorted string array containing values corresponding to the specified key.
|
||||
*/
|
||||
public static String[] getStrings(GeneralParameters key) {
|
||||
String value = getString(key);
|
||||
String[] toReturn = value.split(","); //$NON-NLS-1$
|
||||
Arrays.sort(toReturn);
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC smallet GeneralParametersProvider class global comment. Detailled comment <br/>
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
public enum GeneralParameters {
|
||||
AUTHORIZED_LANGUAGE("param.authorizedlanguage"), //$NON-NLS-1$
|
||||
DEFAULT_PERL_INTERPRETER_WIN32("param.defaultPerlInterpreterPath.win32"), //$NON-NLS-1$
|
||||
DEFAULT_PERL_INTERPRETER_LINUX("param.defaultPerlInterpreterPath.linux"), //$NON-NLS-1$
|
||||
DEFAULT_PERL_INTERPRETER_EMBEDDED_SUFFIX_WIN32("param.defaultPerlInterpreterEmbeddedSuffix.win32"), //$NON-NLS-1$
|
||||
DEFAULT_JAVA_INTERPRETER_SUFFIX_WIN32("param.defaultJavaInterpreterSuffix.win32"), //$NON-NLS-1$
|
||||
DEFAULT_JAVA_INTERPRETER_SUFFIX_LINUX("param.defaultJavaInterpreterSuffix.linux"), //$NON-NLS-1$
|
||||
PROJECTS_EXCLUDED_FROM_EXPORT("param.projectsExcludedFromExport"); //$NON-NLS-1$
|
||||
|
||||
private String paramName;
|
||||
|
||||
GeneralParameters(String paramName) {
|
||||
this.paramName = paramName;
|
||||
}
|
||||
|
||||
public String getParamName() {
|
||||
return this.paramName;
|
||||
}
|
||||
}
|
||||
}
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.prefs;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.talend.commons.i18n.MessagesCore;
|
||||
import org.talend.core.CorePlugin;
|
||||
|
||||
/**
|
||||
* Use to retrieve general application parameters.<br/>
|
||||
*
|
||||
* $Id: Messages.java 1 2006-09-29 17:06:40 +0000 (ven., 29 sept. 2006) nrousseau $
|
||||
*
|
||||
*/
|
||||
public class GeneralParametersProvider extends MessagesCore {
|
||||
|
||||
private static final String BUNDLE_NAME = "parameters"; //$NON-NLS-1$
|
||||
|
||||
private static final String PLUGIN_ID = "org.talend.core"; //$NON-NLS-1$
|
||||
|
||||
private static ResourceBundle resourceBundle;
|
||||
|
||||
private static ResourceBundle getBundle() {
|
||||
if (resourceBundle == null) {
|
||||
try {
|
||||
resourceBundle = ResourceBundle.getBundle(BUNDLE_NAME);
|
||||
} catch (Exception e) {
|
||||
// Nothing to do (return null)
|
||||
}
|
||||
}
|
||||
return resourceBundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value corresponding to the specified key.
|
||||
*/
|
||||
public static String getString(GeneralParameters key) {
|
||||
return getString(key.getParamName(), PLUGIN_ID, getBundle());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sorted string array containing values corresponding to the specified key.
|
||||
*/
|
||||
public static String[] getStrings(GeneralParameters key) {
|
||||
String value = getString(key);
|
||||
String[] toReturn = value.split(","); //$NON-NLS-1$
|
||||
Arrays.sort(toReturn);
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public static String getOnLineHelpLanguageSetting() {
|
||||
String language = CorePlugin.getDefault().getPluginPreferences().getString(ITalendCorePrefConstants.LANGUAGE_SELECTOR);
|
||||
if (StringUtils.isBlank(language)) {
|
||||
language = Locale.getDefault().getLanguage();
|
||||
}
|
||||
if (Locale.FRENCH.getLanguage().equals(language)) {
|
||||
return "fr";
|
||||
}
|
||||
if (Locale.JAPAN.getLanguage().equals(language)) {
|
||||
return "ja";
|
||||
}
|
||||
return "en"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC smallet GeneralParametersProvider class global comment. Detailled comment <br/>
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
public enum GeneralParameters {
|
||||
AUTHORIZED_LANGUAGE("param.authorizedlanguage"), //$NON-NLS-1$
|
||||
DEFAULT_PERL_INTERPRETER_WIN32("param.defaultPerlInterpreterPath.win32"), //$NON-NLS-1$
|
||||
DEFAULT_PERL_INTERPRETER_LINUX("param.defaultPerlInterpreterPath.linux"), //$NON-NLS-1$
|
||||
DEFAULT_PERL_INTERPRETER_EMBEDDED_SUFFIX_WIN32("param.defaultPerlInterpreterEmbeddedSuffix.win32"), //$NON-NLS-1$
|
||||
DEFAULT_JAVA_INTERPRETER_SUFFIX_WIN32("param.defaultJavaInterpreterSuffix.win32"), //$NON-NLS-1$
|
||||
DEFAULT_JAVA_INTERPRETER_SUFFIX_LINUX("param.defaultJavaInterpreterSuffix.linux"), //$NON-NLS-1$
|
||||
PROJECTS_EXCLUDED_FROM_EXPORT("param.projectsExcludedFromExport"); //$NON-NLS-1$
|
||||
|
||||
private String paramName;
|
||||
|
||||
GeneralParameters(String paramName) {
|
||||
this.paramName = paramName;
|
||||
}
|
||||
|
||||
public String getParamName() {
|
||||
return this.paramName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,7 +168,9 @@ public class SwitchContextWithTaggedValue extends AbstractSwitchContextStrategy
|
||||
// case4 both has catalog and schema case then schema maybe set null when both original and target are null with
|
||||
// same time
|
||||
if (isSpecial4Case(targetUiSchema, extractorInstance, originalUiSchema, taggedOriUiShchema)) {
|
||||
TaggedValueHelper.setTaggedValue(dbConn, TaggedValueHelper.ORIGINAL_SID, originalSid);
|
||||
if (originalContext.equals(selectedContext)) {
|
||||
TaggedValueHelper.setTaggedValue(dbConn, TaggedValueHelper.ORIGINAL_SID, originalSid);
|
||||
}
|
||||
TaggedValueHelper.setTaggedValue(dbConn, TaggedValueHelper.ORIGINAL_UISCHEMA, originalUiSchema);
|
||||
hasChanged = true;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.nio.charset.Charset;
|
||||
import java.security.Provider;
|
||||
import java.sql.Connection;
|
||||
import java.sql.Driver;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@@ -208,10 +209,20 @@ public class JDBCDriverLoader {
|
||||
}
|
||||
connection = wapperDriver.connect(url, info);
|
||||
}
|
||||
|
||||
try {
|
||||
ResultSet schemas = connection.getMetaData().getSchemas();
|
||||
if(schemas.next()) {
|
||||
schemas.getString(1);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
// }
|
||||
// DriverManager.deregisterDriver(wapperDriver);
|
||||
// bug 9162
|
||||
list.add(connection);
|
||||
|
||||
list.add(wapperDriver);
|
||||
return list;
|
||||
} catch (Throwable e) {
|
||||
|
||||
@@ -288,6 +288,7 @@ public class MetadataConnectionUtils {
|
||||
String dataBase = databaseConnection.getSID();
|
||||
String dbVersionString = databaseConnection.getDbVersionString();
|
||||
String additionalParams = databaseConnection.getAdditionalParams();
|
||||
boolean supportNLS = databaseConnection.isSupportNLS();
|
||||
|
||||
// MOD qiongli 2011-9-6,TDQ 3317.handle context mode
|
||||
if (databaseConnection.isContextMode()) {
|
||||
@@ -327,6 +328,7 @@ public class MetadataConnectionUtils {
|
||||
metadataConnection.setUsername(userName);
|
||||
metadataConnection.setPassword(password);
|
||||
metadataConnection.setUrl(dbUrl);
|
||||
metadataConnection.setSupportNLS(supportNLS);
|
||||
|
||||
// TDQ-12299: transfer the OtherParameters to metadataConnection, because create impala connection use that
|
||||
// values
|
||||
|
||||
@@ -112,7 +112,6 @@ public class Application implements IApplication {
|
||||
Boolean.TRUE.toString(), false);
|
||||
return IApplication.EXIT_RELAUNCH;
|
||||
}
|
||||
|
||||
try {
|
||||
String vmArgs = System.getProperty(EclipseCommandLine.PROP_VMARGS);
|
||||
if (StringUtils.isNotBlank(vmArgs)) {
|
||||
|
||||
@@ -26,12 +26,14 @@ import org.eclipse.ui.application.IWorkbenchConfigurer;
|
||||
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
|
||||
import org.eclipse.ui.application.WorkbenchWindowAdvisor;
|
||||
import org.eclipse.ui.internal.ide.application.IDEWorkbenchAdvisor;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.LoginException;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.utils.system.EclipseCommandLine;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.repository.utils.LoginTaskRegistryReader;
|
||||
import org.talend.core.service.ICloudSignOnService;
|
||||
import org.talend.core.ui.branding.IBrandingConfiguration;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
import org.talend.core.ui.services.IGitUIProviderService;
|
||||
@@ -135,20 +137,33 @@ public class ApplicationWorkbenchAdvisor extends IDEWorkbenchAdvisor {
|
||||
@Override
|
||||
public void postStartup() {
|
||||
super.postStartup();
|
||||
|
||||
try {
|
||||
if (ICloudSignOnService.get() != null && ICloudSignOnService.get().isSignViaCloud()) {
|
||||
ICloudSignOnService.get().startHeartBeat();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
if (!ArrayUtils.contains(Platform.getApplicationArgs(), EclipseCommandLine.TALEND_DISABLE_LOGINDIALOG_COMMAND)) {
|
||||
RegisterManagement.getInstance().validateRegistration();
|
||||
}
|
||||
|
||||
// PerspectiveReviewUtil.checkPerspectiveDisplayItems();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean preShutdown() {
|
||||
if (IGitUIProviderService.get() != null && IGitUIProviderService.get().checkPendingChanges()) {
|
||||
return false;
|
||||
boolean preShutwond = super.preShutdown();
|
||||
boolean commitChanges = true;
|
||||
if (ICloudSignOnService.get() != null && ICloudSignOnService.get().isReloginDialogRunning()) {
|
||||
commitChanges = false;
|
||||
}
|
||||
return super.preShutdown();
|
||||
if (commitChanges && IGitUIProviderService.get() != null && IGitUIProviderService.get().checkPendingChanges()) {
|
||||
preShutwond = false;
|
||||
}
|
||||
if (preShutwond && ICloudSignOnService.get() != null) {
|
||||
ICloudSignOnService.get().stopHeartBeat();
|
||||
}
|
||||
return preShutwond;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
12
main/plugins/org.talend.signon.util/.classpath
Normal file
12
main/plugins/org.talend.signon.util/.classpath
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-exec.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
47
main/plugins/org.talend.signon.util/.project
Normal file
47
main/plugins/org.talend.signon.util/.project
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.talend.signon.util</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
<nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
20
main/plugins/org.talend.signon.util/META-INF/MANIFEST.MF
Normal file
20
main/plugins/org.talend.signon.util/META-INF/MANIFEST.MF
Normal file
@@ -0,0 +1,20 @@
|
||||
Manifest-Version: 1.0
|
||||
Automatic-Module-Name: org.talend.signon.util
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Cloud sign on util
|
||||
Bundle-SymbolicName: org.talend.signon.util;singleton:=true
|
||||
Bundle-Version: 8.0.1.qualifier
|
||||
Eclipse-LazyStart: true
|
||||
Bundle-ClassPath: .,
|
||||
lib/commons-exec.jar
|
||||
Bundle-Vendor: .Talend SA.
|
||||
Import-Package: org.osgi.framework;version="1.10.0",
|
||||
org.talend.utils.json
|
||||
Export-Package: org.talend.signon.util,
|
||||
org.talend.signon.util.i18n,
|
||||
org.talend.signon.util.listener
|
||||
Require-Bundle: org.talend.utils,
|
||||
org.apache.log4j,
|
||||
org.eclipse.osgi,
|
||||
org.eclipse.equinox.common,
|
||||
org.eclipse.core.runtime
|
||||
1
main/plugins/org.talend.signon.util/META-INF/eclipse.inf
Normal file
1
main/plugins/org.talend.signon.util/META-INF/eclipse.inf
Normal file
@@ -0,0 +1 @@
|
||||
jarprocessor.exclude.children=true
|
||||
8
main/plugins/org.talend.signon.util/build.properties
Normal file
8
main/plugins/org.talend.signon.util/build.properties
Normal file
@@ -0,0 +1,8 @@
|
||||
source.. = src/main/java/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml,\
|
||||
schema/,\
|
||||
lib/commons-exec.jar
|
||||
|
||||
4
main/plugins/org.talend.signon.util/plugin.xml
Normal file
4
main/plugins/org.talend.signon.util/plugin.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.2"?>
|
||||
<plugin>
|
||||
</plugin>
|
||||
44
main/plugins/org.talend.signon.util/pom.xml
Normal file
44
main/plugins/org.talend.signon.util/pom.xml
Normal file
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>tcommon-studio-se</artifactId>
|
||||
<version>8.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../../</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>org.talend.signon.util</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<!-- same as org.talend.libraries.excel -->
|
||||
<id>copy-maven-repository</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<stripVersion>true</stripVersion>
|
||||
<outputDirectory>${project.basedir}/lib</outputDirectory>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-exec</artifactId>
|
||||
<version>1.3</version>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1 @@
|
||||
SSOClientExec.error.timeout=Timeout waiting for login
|
||||
@@ -0,0 +1,55 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
||||
/**
|
||||
* DOC amaumont class global comment. Detailled comment <br/>
|
||||
*
|
||||
*/
|
||||
public class EnvironmentUtils {
|
||||
|
||||
public static boolean isWindowsSystem() {
|
||||
return getEnvOs().startsWith("Windows"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public static boolean isLinuxUnixSystem() {
|
||||
return !isWindowsSystem() && !isMacOsSytem();
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC amaumont Comment method "isMacOsSytem".
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static boolean isMacOsSytem() {
|
||||
return getEnvOs().startsWith("Mac"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC amaumont Comment method "getEnv".
|
||||
*/
|
||||
public static String getEnvOs() {
|
||||
return System.getProperty("os.name"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public static boolean isX86_64() {
|
||||
return StringUtils.equals(Platform.ARCH_X86_64, Platform.getOSArch());
|
||||
}
|
||||
|
||||
public static boolean isAarch64() {
|
||||
return StringUtils.equals(Platform.ARCH_AARCH64, Platform.getOSArch());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
|
||||
import org.eclipse.osgi.service.datalocation.Location;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.Filter;
|
||||
import org.osgi.framework.FrameworkUtil;
|
||||
import org.osgi.framework.InvalidSyntaxException;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
import org.osgi.util.tracker.ServiceTracker;
|
||||
|
||||
public class EquinoxUtils {
|
||||
|
||||
public static URL[] getConfigAreaURL(BundleContext context) {
|
||||
Location configLocation = getConfigLocation(context);
|
||||
if (configLocation == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
URL baseURL = configLocation.getURL();
|
||||
if (configLocation.getParentLocation() != null && configLocation.getURL() != null) {
|
||||
if (baseURL == null) {
|
||||
return new URL[] { configLocation.getParentLocation().getURL() };
|
||||
} else {
|
||||
return new URL[] { baseURL, configLocation.getParentLocation().getURL() };
|
||||
}
|
||||
}
|
||||
if (baseURL != null) {
|
||||
return new URL[] { baseURL };
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Location getConfigLocation(BundleContext context) {
|
||||
Filter filter = null;
|
||||
try {
|
||||
filter = context.createFilter(Location.CONFIGURATION_FILTER);
|
||||
} catch (InvalidSyntaxException e) {
|
||||
// should not happen
|
||||
}
|
||||
ServiceTracker configLocationTracker = new ServiceTracker(context, filter, null);
|
||||
configLocationTracker.open();
|
||||
try {
|
||||
return (Location) configLocationTracker.getService();
|
||||
} finally {
|
||||
configLocationTracker.close();
|
||||
}
|
||||
}
|
||||
|
||||
public static URI getInstallLocationURI(BundleContext context) {
|
||||
try {
|
||||
ServiceReference[] references = context.getServiceReferences(Location.class.getName(), Location.INSTALL_FILTER);
|
||||
if (references != null && references.length > 0) {
|
||||
ServiceReference reference = references[0];
|
||||
Location installLocation = (Location) context.getService(reference);
|
||||
if (installLocation != null) {
|
||||
try {
|
||||
if (installLocation.isSet()) {
|
||||
URL location = installLocation.getURL();
|
||||
return URIUtil.toURI(location);
|
||||
}
|
||||
} catch (URISyntaxException e) {
|
||||
// TODO: log an error
|
||||
} finally {
|
||||
context.ungetService(reference);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (InvalidSyntaxException e) {
|
||||
// TODO: log an error
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// always return a valid bundlesContext or throw a runtimeException
|
||||
public static BundleContext getCurrentBundleContext() {
|
||||
Bundle bundle = FrameworkUtil.getBundle(EquinoxUtils.class);
|
||||
if (bundle != null) {
|
||||
BundleContext bundleContext = bundle.getBundleContext();
|
||||
if (bundleContext != null) {
|
||||
return bundleContext;
|
||||
} else {
|
||||
throw new RuntimeException(
|
||||
"could not find current BundleContext, this should never happen, check that the bunlde is activated when this class is accessed");
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException(
|
||||
"could not find current Bundle, this should never happen, check that the bunlde is activated when this class is accessed");
|
||||
}
|
||||
}
|
||||
|
||||
public static File getConfigurationFolder() {
|
||||
BundleContext configuratorBundleContext = getCurrentBundleContext();
|
||||
final URL url = getConfigLocation(configuratorBundleContext).getURL();
|
||||
try {
|
||||
return URIUtil.toFile(URIUtil.toURI(url));
|
||||
} catch (URISyntaxException e) {
|
||||
//
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import org.apache.commons.exec.CommandLine;
|
||||
import org.apache.commons.exec.DefaultExecutor;
|
||||
import org.apache.commons.exec.ExecuteException;
|
||||
import org.apache.commons.exec.ExecuteWatchdog;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.equinox.app.IApplication;
|
||||
import org.talend.signon.util.i18n.Messages;
|
||||
import org.talend.signon.util.listener.LoginEventListener;
|
||||
|
||||
public class SSOClientExec implements Runnable {
|
||||
|
||||
private static Logger LOGGER = Logger.getLogger(SSOClientExec.class);
|
||||
|
||||
public static final String STUDIO_CALL_PREFIX = "studioCall:";
|
||||
|
||||
private static final String STUDIO_SSO_CLIENT_DEBUG_PORT = "talend.studio.sso.client.debug.port";
|
||||
|
||||
private File execFile;
|
||||
|
||||
private String codeChallenge;
|
||||
|
||||
private String clientId;
|
||||
|
||||
private int port;
|
||||
|
||||
private ExecuteWatchdog executeWatchdog;
|
||||
|
||||
private Exception error;
|
||||
|
||||
private LoginEventListener listener;
|
||||
|
||||
public SSOClientExec(File execFile, String clientId, String codeChallenge, int port, LoginEventListener listener) {
|
||||
this.execFile = execFile;
|
||||
this.clientId = clientId;
|
||||
this.codeChallenge = codeChallenge;
|
||||
this.port = port;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
int exitValue = 0;
|
||||
try {
|
||||
CommandLine cmdLine = new CommandLine(execFile);
|
||||
String url = getInvokeParameter(clientId, port);
|
||||
cmdLine.addArgument(url);
|
||||
if (SSOClientUtil.isDebugMode()) {
|
||||
LOGGER.info("Opening:" + url.substring(STUDIO_CALL_PREFIX.length()));
|
||||
}
|
||||
if (getClientDebugPort() != null) {
|
||||
cmdLine.addArgument("-vmargs");
|
||||
cmdLine.addArgument("-Xdebug");
|
||||
String cmd = "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=*:" + getClientDebugPort();
|
||||
cmdLine.addArgument(cmd);
|
||||
}
|
||||
DefaultExecutor executor = new DefaultExecutor();
|
||||
executeWatchdog = new ExecuteWatchdog(900000);
|
||||
executor.setWatchdog(executeWatchdog);
|
||||
executor.setExitValues(new int[] { 0, 24, 143 }); // normal, restart, process existed
|
||||
if (!execFile.canExecute()) {
|
||||
execFile.setExecutable(true);
|
||||
}
|
||||
executor.setWorkingDirectory(execFile.getParentFile());
|
||||
exitValue = executor.execute(cmdLine);
|
||||
if (IApplication.EXIT_RELAUNCH == exitValue) {
|
||||
cmdLine = new CommandLine(execFile);
|
||||
if (getClientDebugPort() != null) {
|
||||
cmdLine.addArgument("-vmargs");
|
||||
cmdLine.addArgument("-Xdebug");
|
||||
String cmd = "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=*:" + getClientDebugPort();
|
||||
cmdLine.addArgument(cmd);
|
||||
}
|
||||
exitValue = executor.execute(cmdLine);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
error = e;
|
||||
LOGGER.error(e);
|
||||
listener.loginFailed(e);
|
||||
}
|
||||
}
|
||||
|
||||
private String getClientDebugPort() {
|
||||
return System.getProperty(STUDIO_SSO_CLIENT_DEBUG_PORT);
|
||||
}
|
||||
|
||||
private String getInvokeParameter(String clientID, int callbackPort) throws UnsupportedEncodingException {
|
||||
return STUDIO_CALL_PREFIX + SSOClientUtil.getInstance().getSignOnURL(clientID, codeChallenge, callbackPort);
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
if (executeWatchdog != null && !executeWatchdog.killedProcess()) {
|
||||
executeWatchdog.destroyProcess();
|
||||
}
|
||||
}
|
||||
|
||||
public Exception getError() {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.talend.utils.io.FilesUtils;
|
||||
|
||||
public class SSOClientInstaller {
|
||||
|
||||
private static Logger LOGGER = Logger.getLogger(SSOClientInstaller.class);
|
||||
|
||||
private final String SIGN_CLIENT_BUNDLE_NAME = "org.talend.singlesignon.client";
|
||||
|
||||
private final String INSTALL_FOLDER_NAME = "repository";
|
||||
|
||||
private final String INSTALL_FILE_NAME = "TalendSignTool.zip";
|
||||
|
||||
private final String version = "8.0.1.202206081050";
|
||||
|
||||
private static final SSOClientInstaller instance = new SSOClientInstaller();
|
||||
|
||||
public static SSOClientInstaller getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private SSOClientInstaller() {
|
||||
}
|
||||
|
||||
public boolean isNeedInstall() {
|
||||
String installedVersion = getInstalledVersion();
|
||||
if (SSOClientUtil.isDebugMode()) {
|
||||
LOGGER.info(String.format("Installed client version is %s and latest version is %s .", installedVersion, version));
|
||||
}
|
||||
if (installedVersion != null && installedVersion.compareTo(version) >= 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void install() throws Exception {
|
||||
File sourceFile = getInstallFile();
|
||||
if (!sourceFile.exists()) {
|
||||
LOGGER.error("Can't find install file:" + sourceFile.getAbsolutePath());
|
||||
}
|
||||
File targetFolder = getInstallDir();
|
||||
if (targetFolder.exists()) {
|
||||
FilesUtils.deleteFolder(targetFolder, true);
|
||||
LOGGER.info("Deleted target folder:" + targetFolder.getAbsolutePath());
|
||||
}
|
||||
targetFolder.mkdirs();
|
||||
if (SSOClientUtil.isDebugMode()) {
|
||||
LOGGER.info("Created target folder:" + targetFolder.getAbsolutePath());
|
||||
}
|
||||
FilesUtils.unzip(sourceFile.getAbsolutePath(), targetFolder.getAbsolutePath(), true);
|
||||
if (SSOClientUtil.isDebugMode()) {
|
||||
LOGGER.info("Installed client:" + targetFolder.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
private String getInstalledVersion() {
|
||||
FileInputStream in = null;
|
||||
try {
|
||||
File eclipseProductFile = getEclipseProductFile();
|
||||
if (eclipseProductFile != null && eclipseProductFile.exists()) {
|
||||
Properties p = new Properties();
|
||||
in = new FileInputStream(eclipseProductFile);
|
||||
p.load(in);
|
||||
String productFileVersion = p.getProperty("version"); //$NON-NLS-1$
|
||||
return productFileVersion;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(e);
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
LOGGER.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private File getEclipseProductFile() throws URISyntaxException {
|
||||
File eclipseproductFile = new File(getInstallDir(), ".eclipseproduct");//$NON-NLS-1$
|
||||
return eclipseproductFile;
|
||||
}
|
||||
|
||||
protected File getInstallDir() {
|
||||
return SSOClientUtil.getSSOClientFolder();
|
||||
}
|
||||
|
||||
protected File getInstallFile() throws IOException {
|
||||
BundleContext context = EquinoxUtils.getCurrentBundleContext();
|
||||
Bundle[] bundles = context.getBundles();
|
||||
Bundle bundle = null;
|
||||
for (Bundle b : bundles) {
|
||||
if (SIGN_CLIENT_BUNDLE_NAME.equals(b.getSymbolicName())) {
|
||||
bundle = b;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (bundle != null) {
|
||||
File bundleFile = FileLocator.getBundleFile(bundle).getAbsoluteFile();
|
||||
File folder = new File(bundleFile, INSTALL_FOLDER_NAME);
|
||||
File installFile = new File(folder, INSTALL_FILE_NAME);
|
||||
return installFile;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.talend.signon.util.listener.LoginEventListener;
|
||||
|
||||
public class SSOClientMonitor implements Runnable {
|
||||
|
||||
private static Logger LOGGER = Logger.getLogger(SSOClientMonitor.class);
|
||||
|
||||
private static final String STUDIO_AUTH_CODE_KEY = "code";
|
||||
|
||||
private static final String STUDIO_AUTH_STATE_KEY = "state";
|
||||
|
||||
private static final String STUDIO_CALLBACK_PREFIX = "studioCallback:";
|
||||
|
||||
private static final String STUDIO_CALLBACK_ERROR_PREFIX = "studioCallbackError:";
|
||||
|
||||
private static final SSOClientMonitor instance = new SSOClientMonitor();
|
||||
|
||||
private static int listenPort = -1;
|
||||
|
||||
private static volatile boolean isRunning = false;
|
||||
|
||||
private Set<LoginEventListener> listenerSet = new HashSet<LoginEventListener>();
|
||||
|
||||
public static SSOClientMonitor getInscance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private SSOClientMonitor() {
|
||||
|
||||
}
|
||||
|
||||
private void processData(String msg) {
|
||||
if (msg.startsWith(STUDIO_CALLBACK_PREFIX)) {
|
||||
msg = msg.substring(STUDIO_CALLBACK_PREFIX.length());
|
||||
Map<String, String> data = decodeMsg(msg);
|
||||
String code = data.get(STUDIO_AUTH_CODE_KEY);
|
||||
String state = data.get(STUDIO_AUTH_STATE_KEY);
|
||||
|
||||
String[] splits = state.split(",");
|
||||
String dateCenter = TMCRepositoryUtil.getDefaultDataCenter();
|
||||
if (splits.length == 2) {
|
||||
dateCenter = splits[1];
|
||||
}
|
||||
fireLoginStop(code, dateCenter);
|
||||
}
|
||||
|
||||
if (msg.startsWith(STUDIO_CALLBACK_ERROR_PREFIX)) {
|
||||
msg = msg.substring(STUDIO_CALLBACK_ERROR_PREFIX.length());
|
||||
fireLoginFailed(new Exception (msg));
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, String> decodeMsg(String data) {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
if (data.startsWith(STUDIO_CALLBACK_PREFIX)) {
|
||||
data = data.substring(STUDIO_CALLBACK_PREFIX.length());
|
||||
}
|
||||
if (data.startsWith(SSOUtil.STUDIO_REDIRECT_URL)) {
|
||||
data = data.substring(SSOUtil.STUDIO_REDIRECT_URL.length());
|
||||
}
|
||||
if (data.startsWith("?")) {
|
||||
data = data.substring("?".length());
|
||||
}
|
||||
|
||||
String[] splits = data.split("&");
|
||||
for (int i = 0; i < splits.length; i++) {
|
||||
String str = splits[i];
|
||||
String[] spls = str.split("=");
|
||||
if (spls.length == 2) {
|
||||
map.put(spls[0], spls[1]);
|
||||
} else {
|
||||
LOGGER.error("Parse msg error is should be contains =:" + str);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
isRunning = false;
|
||||
listenPort = -1;
|
||||
}
|
||||
|
||||
private Integer newPort() {
|
||||
final Integer port = Integer.getInteger("stduio.login.client.monitor.port", -1);
|
||||
if (port <= 0) {
|
||||
try (ServerSocket socket = new ServerSocket(0)) {
|
||||
socket.setReuseAddress(true);
|
||||
return socket.getLocalPort();
|
||||
} catch (final IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
return port;
|
||||
}
|
||||
|
||||
private void fireLoginStop(String code, String dataCenter) {
|
||||
for (LoginEventListener l : listenerSet) {
|
||||
try {
|
||||
l.loginStop(code, dataCenter);
|
||||
} catch (Exception ex) {
|
||||
LOGGER.error(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void fireLoginStart() {
|
||||
for (LoginEventListener l : listenerSet) {
|
||||
try {
|
||||
l.loginStart();
|
||||
} catch (Exception ex) {
|
||||
LOGGER.error(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void fireLoginFailed(Exception ex) {
|
||||
for (LoginEventListener l : listenerSet) {
|
||||
try {
|
||||
l.loginFailed(ex);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addLoginEventListener(LoginEventListener listener) {
|
||||
listenerSet.add(listener);
|
||||
}
|
||||
|
||||
public void removeLoginEventListener(LoginEventListener listener) {
|
||||
if (listenerSet.contains(listener)) {
|
||||
listenerSet.remove(listener);
|
||||
}
|
||||
}
|
||||
|
||||
public int getListenPort() {
|
||||
return listenPort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (isRunning) {
|
||||
LOGGER.info("Login client monitor started.");
|
||||
return;
|
||||
}
|
||||
listenPort = newPort();
|
||||
ServerSocket server;
|
||||
try {
|
||||
server = new ServerSocket(listenPort);
|
||||
if (SSOClientUtil.isDebugMode()) {
|
||||
LOGGER.info("Start sso client monitor on " + listenPort);
|
||||
}
|
||||
isRunning = true;
|
||||
fireLoginStart();
|
||||
while (isRunning) {
|
||||
Socket socket = server.accept();
|
||||
try {
|
||||
InputStream inputStream = socket.getInputStream();
|
||||
byte[] bytes = new byte[1024];
|
||||
int len;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while ((len = inputStream.read(bytes)) != -1) {
|
||||
sb.append(new String(bytes, 0, len, StandardCharsets.UTF_8));
|
||||
}
|
||||
inputStream.close();
|
||||
processData(sb.toString());
|
||||
stop();
|
||||
if (SSOClientUtil.isDebugMode()) {
|
||||
LOGGER.info("Stop sso client monitor");
|
||||
}
|
||||
break;
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(e);
|
||||
fireLoginFailed(e);
|
||||
} finally {
|
||||
try {
|
||||
socket.close();
|
||||
} catch (IOException e) {
|
||||
LOGGER.error(e);
|
||||
fireLoginFailed(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LOGGER.error(ex);
|
||||
fireLoginFailed(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isRunning() {
|
||||
return isRunning;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.talend.signon.util.listener.LoginEventListener;
|
||||
|
||||
public class SSOClientUtil {
|
||||
|
||||
private static Logger LOGGER = Logger.getLogger(SSOClientUtil.class);
|
||||
|
||||
private static final String STUDIO_CLIENT_ID = "0c51933d-c542-4918-9baf-86ef709af5d8";
|
||||
|
||||
private static final String CLIENT_FILE_PATH_PROPERTY = "talend.studio.signon.client.path";
|
||||
|
||||
private static final String CLIENT_FILE_NAME_ON_WINDOWS = "Talend_Sign_On_Tool_win-x86_64.exe";
|
||||
|
||||
private static final String CLIENT_FILE_NAME_ON_LINUX_X86 = "Talend_Sign_On_Tool_linux_gtk_x86_64";
|
||||
|
||||
private static final String CLIENT_FILE_NAME_ON_LINUX_AARCH64 = "Talend_Sign_On_Tool_linux_gtk_aarch64";
|
||||
|
||||
private static final String CLIENT_FILE_NAME_ON_MAC_X86 = "Talend_Sign_On_Tool.app";
|
||||
|
||||
private static final String CLIENT_FILE_NAME_ON_MAC_AARCH64 = "Talend_Sign_On_Tool_aarch64.app";
|
||||
|
||||
private static final String CLIENT_FOLDER_NAME = "studio_sso_client";
|
||||
|
||||
static final String DATA_CENTER_KEY = "talend.tmc.datacenter";
|
||||
|
||||
static final String DATA_CENTER_DISPLAY_KEY = "talend.tmc.datacenter.display";
|
||||
|
||||
public static final String TALEND_DEBUG = "--talendDebug"; //$NON-NLS-1$
|
||||
|
||||
private static final SSOClientUtil instance = new SSOClientUtil();
|
||||
|
||||
private SSOClientExec signOnClientExec;
|
||||
|
||||
private SSOClientUtil() {
|
||||
if (SSOClientInstaller.getInstance().isNeedInstall()) {
|
||||
try {
|
||||
SSOClientInstaller.getInstance().install();
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getClientID() throws IOException {
|
||||
return STUDIO_CLIENT_ID;
|
||||
}
|
||||
|
||||
public File getSSOClientAppFile() throws Exception {
|
||||
if (System.getProperty(CLIENT_FILE_PATH_PROPERTY) != null) {
|
||||
return new File(System.getProperty(CLIENT_FILE_PATH_PROPERTY));
|
||||
}
|
||||
File folder = getSSOClientFolder();
|
||||
if (EnvironmentUtils.isWindowsSystem()) {
|
||||
return new File(folder, CLIENT_FILE_NAME_ON_WINDOWS);
|
||||
} else if (EnvironmentUtils.isLinuxUnixSystem()) {
|
||||
if (EnvironmentUtils.isX86_64()) {
|
||||
return new File(folder, CLIENT_FILE_NAME_ON_LINUX_X86);
|
||||
} else if (EnvironmentUtils.isAarch64()) {
|
||||
return new File(folder, CLIENT_FILE_NAME_ON_LINUX_AARCH64);
|
||||
}
|
||||
} else if (EnvironmentUtils.isMacOsSytem()) {
|
||||
File appFolder = null;
|
||||
if (EnvironmentUtils.isX86_64()) {
|
||||
appFolder = new File(folder, CLIENT_FILE_NAME_ON_MAC_X86);
|
||||
} else if (EnvironmentUtils.isAarch64()) {
|
||||
appFolder = new File(folder, CLIENT_FILE_NAME_ON_MAC_AARCH64);
|
||||
}
|
||||
if (appFolder != null) {
|
||||
return new File(appFolder, "Contents/MacOS/Talend_Sign_On_Tool");
|
||||
}
|
||||
}
|
||||
throw new Exception("Unsupported OS");
|
||||
}
|
||||
|
||||
public static File getSSOClientFolder() {
|
||||
File configFolder = EquinoxUtils.getConfigurationFolder();
|
||||
File signClientFolder = new File(configFolder, CLIENT_FOLDER_NAME);
|
||||
return signClientFolder;
|
||||
}
|
||||
|
||||
private synchronized void startSignOnClient(LoginEventListener listener) throws Exception {
|
||||
if (signOnClientExec != null) {
|
||||
signOnClientExec.stop();
|
||||
}
|
||||
String clientId = getClientID();
|
||||
File execFile = getSSOClientAppFile();
|
||||
String codeChallenge = listener.getCodeChallenge();
|
||||
if (isDebugMode()) {
|
||||
LOGGER.info("Prepare to start login cloud client monitor");
|
||||
}
|
||||
SSOClientMonitor signOnClientListener = SSOClientMonitor.getInscance();
|
||||
signOnClientListener.addLoginEventListener(listener);
|
||||
new Thread(signOnClientListener).start();
|
||||
if (isDebugMode()) {
|
||||
LOGGER.info("Login cloud client monitor started.");
|
||||
}
|
||||
while (!SSOClientMonitor.isRunning()) {
|
||||
TimeUnit.MILLISECONDS.sleep(100);
|
||||
}
|
||||
if (signOnClientListener.getListenPort() < 0) {
|
||||
throw new Exception("Login cloud client monitor start failed.");
|
||||
}
|
||||
if (isDebugMode()) {
|
||||
LOGGER.info("Prepare to start cloud client on " + signOnClientListener.getListenPort());
|
||||
}
|
||||
signOnClientExec = new SSOClientExec(execFile, clientId, codeChallenge, signOnClientListener.getListenPort(), listener);
|
||||
new Thread(signOnClientExec).start();
|
||||
if (isDebugMode()) {
|
||||
LOGGER.info("Login cloud client started.");
|
||||
}
|
||||
}
|
||||
|
||||
public static SSOClientUtil getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void signOnCloud(LoginEventListener listener) throws Exception {
|
||||
SSOClientUtil.getInstance().startSignOnClient(listener);
|
||||
}
|
||||
|
||||
public String getSignOnURL(String clientID, String codeChallenge, int callbackPort) throws UnsupportedEncodingException {
|
||||
String dataCenter = TMCRepositoryUtil.getDefaultDataCenter();
|
||||
StringBuffer urlSB = new StringBuffer();
|
||||
urlSB.append(TMCRepositoryUtil.getBaseLoginURL(dataCenter)).append("?");
|
||||
urlSB.append("client_id=").append(URLEncoder.encode(clientID, StandardCharsets.UTF_8.name())).append("&");
|
||||
urlSB.append("redirect_uri=")
|
||||
.append(URLEncoder.encode(TMCRepositoryUtil.getRedirectURL(dataCenter), StandardCharsets.UTF_8.name()))
|
||||
.append("&");
|
||||
urlSB.append("scope=").append(URLEncoder.encode("openid refreshToken", StandardCharsets.UTF_8.name())).append("&");
|
||||
urlSB.append("response_type=").append(URLEncoder.encode("code", StandardCharsets.UTF_8.name())).append("&");
|
||||
urlSB.append("code_challenge_method=").append(URLEncoder.encode("S256", StandardCharsets.UTF_8.name())).append("&");
|
||||
urlSB.append("code_challenge=").append(URLEncoder.encode(codeChallenge, StandardCharsets.UTF_8.name())).append("&");
|
||||
String state = String.valueOf(callbackPort) + SSOUtil.STATE_PARAM_SEPARATOR + TMCRepositoryUtil.getDefaultDataCenter();
|
||||
urlSB.append("state=").append(URLEncoder.encode(state, StandardCharsets.UTF_8.name()));
|
||||
return urlSB.toString();
|
||||
}
|
||||
|
||||
public static boolean isDebugMode() {
|
||||
return Boolean.getBoolean("talendDebug") //$NON-NLS-1$
|
||||
|| ArrayUtils.contains(Platform.getApplicationArgs(), SSOClientUtil.TALEND_DEBUG);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Base64;
|
||||
|
||||
public class SSOUtil {
|
||||
|
||||
public static final String STUDIO_REDIRECT_URL = "talendstudio://code";
|
||||
|
||||
public static final String STATE_PARAM_SEPARATOR = ",";
|
||||
|
||||
public static String generateCodeVerifier() {
|
||||
SecureRandom secureRandom = new SecureRandom();
|
||||
byte[] codeVerifier = new byte[32];
|
||||
secureRandom.nextBytes(codeVerifier);
|
||||
return Base64.getUrlEncoder().withoutPadding().encodeToString(codeVerifier);
|
||||
}
|
||||
|
||||
public static String getCodeChallenge(String seed) throws Exception {
|
||||
byte[] bytes = seed.getBytes("US-ASCII");
|
||||
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
|
||||
messageDigest.update(bytes, 0, bytes.length);
|
||||
byte[] digest = messageDigest.digest();
|
||||
return Base64.getUrlEncoder().withoutPadding().encodeToString(digest);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util;
|
||||
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.runtime.preferences.ConfigurationScope;
|
||||
import org.osgi.service.prefs.BackingStoreException;
|
||||
import org.osgi.service.prefs.Preferences;
|
||||
|
||||
|
||||
public class TMCRepositoryUtil {
|
||||
private static Logger LOGGER = Logger.getLogger(TMCRepositoryUtil.class);
|
||||
|
||||
public static final String REPOSITORY_CLOUD_US_ID = "cloud_us"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_EU_ID = "cloud_eu"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_APAC_ID = "cloud_apac"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_US_WEST_ID = "cloud_us_west"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_AUS_ID = "cloud_aus"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_US_DISPALY = "United States - East on AWS"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_EU_DISPALY = "Europe on AWS"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_APAC_DISPALY = "Asia Pacific on AWS"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_US_WEST_DISPALY = "United States - West on Azure"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_AUS_DISPALY = "Australia on AWS"; //$NON-NLS-1$
|
||||
|
||||
public static final String REPOSITORY_CLOUD_CUSTOM_ID = "cloud_custom"; //$NON-NLS-1$
|
||||
|
||||
public static final String AUTHORIZE_URL = "https://iam.%s.cloud.talend.com/oidc/idp/authorize"; //$NON-NLS-1$
|
||||
|
||||
public static final String ADMIN_URL = "https://tmc.%s.cloud.talend.com/studio_cloud_connection"; //$NON-NLS-1$
|
||||
|
||||
public static final String TOKEN_URL = "https://iam.%s.cloud.talend.com/oidc/oauth2/token"; //$NON-NLS-1$
|
||||
|
||||
public static final String SUCCESS_REDIRECT_URL = "https://iam.%s.cloud.talend.com/idp/login-sso-success"; //$NON-NLS-1$
|
||||
|
||||
public static final String ONLINE_HELP_URL = "https://document-link.us.cloud.talend.com/ts_ug_launch-studio?version=%s&lang=%s&env=prd";
|
||||
|
||||
public static final String ORG_TALEND_WORKSPACE_PREF_NODE = "org.eclipse.ui.ide"; //$NON-NLS-1$
|
||||
|
||||
public static final String ORG_TALEND_RECENT_DATA_CENTERR = "org.talend.recent.datacenter";
|
||||
|
||||
public static String getBaseLoginURL(String dataCenter) {
|
||||
if (dataCenter == null) {
|
||||
dataCenter = TMCRepositoryUtil.getDefaultDataCenter();
|
||||
}
|
||||
return String.format(AUTHORIZE_URL, dataCenter);
|
||||
}
|
||||
|
||||
public static String getDefaultDataCenter() {
|
||||
String defaultDataCenter = "us";
|
||||
if (getRecentDataCenter() != null) {
|
||||
defaultDataCenter = getRecentDataCenter();
|
||||
}
|
||||
if (System.getProperty(SSOClientUtil.DATA_CENTER_KEY) != null) {
|
||||
defaultDataCenter = System.getProperty(SSOClientUtil.DATA_CENTER_KEY);
|
||||
}
|
||||
return defaultDataCenter;
|
||||
}
|
||||
|
||||
public static void saveRecentDataCenter(String dataCenter) {
|
||||
Preferences node = new ConfigurationScope().getNode(ORG_TALEND_WORKSPACE_PREF_NODE);
|
||||
node.put(ORG_TALEND_RECENT_DATA_CENTERR, dataCenter);
|
||||
try {
|
||||
node.flush();
|
||||
} catch (BackingStoreException e) {
|
||||
LOGGER.error("failed to store workspace location in preferences :", e); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
public static String getRecentDataCenter() {
|
||||
Preferences node = new ConfigurationScope().getNode(ORG_TALEND_WORKSPACE_PREF_NODE);
|
||||
return node.get(ORG_TALEND_RECENT_DATA_CENTERR, null);
|
||||
}
|
||||
|
||||
public static String getCloudAdminURL(String dataCenter) {
|
||||
return String.format(ADMIN_URL, dataCenter);
|
||||
}
|
||||
|
||||
public static String getTokenURL(String dataCenter) {
|
||||
return String.format(TOKEN_URL, dataCenter);
|
||||
}
|
||||
|
||||
public static String getRedirectURL(String dataCenter) {
|
||||
if (dataCenter == null) {
|
||||
dataCenter = getDefaultDataCenter();
|
||||
}
|
||||
return String.format(SUCCESS_REDIRECT_URL, dataCenter);
|
||||
}
|
||||
|
||||
public static String getDisplayNameByDatacenter(String dataCenter) {
|
||||
if ("ap".equals(dataCenter)) {
|
||||
return REPOSITORY_CLOUD_APAC_DISPALY;
|
||||
}
|
||||
if ("us".equals(dataCenter)) {
|
||||
return REPOSITORY_CLOUD_US_DISPALY;
|
||||
}
|
||||
if ("us-west".equals(dataCenter)) {
|
||||
return REPOSITORY_CLOUD_US_WEST_DISPALY;
|
||||
}
|
||||
if ("eu".equals(dataCenter)) {
|
||||
return REPOSITORY_CLOUD_EU_DISPALY;
|
||||
}
|
||||
if ("au".equals(dataCenter)) {
|
||||
return REPOSITORY_CLOUD_AUS_DISPALY;
|
||||
}
|
||||
|
||||
if (System.getProperty(SSOClientUtil.DATA_CENTER_DISPLAY_KEY) != null) {
|
||||
return System.getProperty(SSOClientUtil.DATA_CENTER_DISPLAY_KEY);
|
||||
}
|
||||
|
||||
return dataCenter;
|
||||
}
|
||||
|
||||
public static String getRepositoryId(String dataCenter) {
|
||||
if ("ap".equals(dataCenter)) {
|
||||
return REPOSITORY_CLOUD_APAC_ID;
|
||||
}
|
||||
if ("us".equals(dataCenter)) {
|
||||
return REPOSITORY_CLOUD_US_ID;
|
||||
}
|
||||
if ("us-west".equals(dataCenter)) {
|
||||
return REPOSITORY_CLOUD_US_WEST_ID;
|
||||
}
|
||||
if ("eu".equals(dataCenter)) {
|
||||
return REPOSITORY_CLOUD_EU_ID;
|
||||
}
|
||||
if ("au".equals(REPOSITORY_CLOUD_AUS_ID)) {
|
||||
return REPOSITORY_CLOUD_EU_ID;
|
||||
}
|
||||
return REPOSITORY_CLOUD_CUSTOM_ID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util;
|
||||
|
||||
import org.talend.utils.json.JSONException;
|
||||
import org.talend.utils.json.JSONObject;
|
||||
|
||||
public class TokenMode {
|
||||
|
||||
private static final String ACCESS_TOKEN_KEY = "access_token";
|
||||
|
||||
private static final String EXPIRES_IN_KEY = "expires_in";
|
||||
|
||||
private static final String ID_TOKEN_KEY = "id_token";
|
||||
|
||||
private static final String REFRESH_TOKEN_KEY = "refresh_token";
|
||||
|
||||
private static final String SCOPE_KEY = "scope";
|
||||
|
||||
private static final String TOKEN_TYPE_KEY = "token_type";
|
||||
|
||||
private static final String LAST_REFRESH_TIME_KEY = "last_refresh_time";
|
||||
|
||||
private static final String DATA_CENTER_KEY = "data_center";
|
||||
|
||||
private String clientId;
|
||||
|
||||
private String accessToken;
|
||||
|
||||
private String refreshToken;
|
||||
|
||||
private long expiresIn;
|
||||
|
||||
private String idToken;
|
||||
|
||||
private String scope;
|
||||
|
||||
private String tokenType;
|
||||
|
||||
private String dataCenter;
|
||||
|
||||
private long lastRefreshTime = System.currentTimeMillis();
|
||||
|
||||
public String getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public void setClientId(String clientId) {
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
public String getAccessToken() {
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
public void setAccessToken(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
|
||||
public String getRefreshToken() {
|
||||
return refreshToken;
|
||||
}
|
||||
|
||||
public void setRefreshToken(String refreshToken) {
|
||||
this.refreshToken = refreshToken;
|
||||
}
|
||||
|
||||
public long getExpiresIn() {
|
||||
return expiresIn;
|
||||
}
|
||||
|
||||
public void setExpiresIn(long expiresIn) {
|
||||
this.expiresIn = expiresIn;
|
||||
}
|
||||
|
||||
public String getIdToken() {
|
||||
return idToken;
|
||||
}
|
||||
|
||||
public void setIdToken(String idToken) {
|
||||
this.idToken = idToken;
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public String getTokenType() {
|
||||
return tokenType;
|
||||
}
|
||||
|
||||
public void setTokenType(String tokenType) {
|
||||
this.tokenType = tokenType;
|
||||
}
|
||||
|
||||
public long getLastRefreshTime() {
|
||||
return lastRefreshTime;
|
||||
}
|
||||
|
||||
public void setLastRefreshTime(long lastRefreshTime) {
|
||||
this.lastRefreshTime = lastRefreshTime;
|
||||
}
|
||||
|
||||
public String getDataCenter() {
|
||||
return dataCenter;
|
||||
}
|
||||
|
||||
public void setDataCenter(String dataCenter) {
|
||||
this.dataCenter = dataCenter;
|
||||
}
|
||||
|
||||
public static TokenMode parseFromJson(String jsonString, String dataCenter) throws JSONException {
|
||||
JSONObject jsonObj = new JSONObject(jsonString);
|
||||
TokenMode token = new TokenMode();
|
||||
token.setAccessToken(jsonObj.getString(TokenMode.ACCESS_TOKEN_KEY));
|
||||
token.setExpiresIn(jsonObj.getLong(TokenMode.EXPIRES_IN_KEY));
|
||||
if (jsonObj.has(TokenMode.ID_TOKEN_KEY)) {
|
||||
token.setIdToken(jsonObj.getString(TokenMode.ID_TOKEN_KEY));
|
||||
}
|
||||
token.setRefreshToken(jsonObj.getString(TokenMode.REFRESH_TOKEN_KEY));
|
||||
token.setScope(jsonObj.getString(TokenMode.SCOPE_KEY));
|
||||
token.setTokenType(jsonObj.getString(TokenMode.TOKEN_TYPE_KEY));
|
||||
if (jsonObj.has(TokenMode.LAST_REFRESH_TIME_KEY)) {
|
||||
token.setLastRefreshTime(jsonObj.getLong(TokenMode.LAST_REFRESH_TIME_KEY));
|
||||
}
|
||||
if (dataCenter == null && jsonObj.has(TokenMode.DATA_CENTER_KEY)) {
|
||||
token.setDataCenter(jsonObj.getString(TokenMode.DATA_CENTER_KEY));
|
||||
} else {
|
||||
token.setDataCenter(dataCenter);
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
public static JSONObject writeToJson(TokenMode token) throws JSONException {
|
||||
JSONObject object = new JSONObject();
|
||||
object.put(TokenMode.ACCESS_TOKEN_KEY, token.getAccessToken());
|
||||
object.put(TokenMode.EXPIRES_IN_KEY, token.getExpiresIn());
|
||||
object.put(TokenMode.ID_TOKEN_KEY, token.getIdToken());
|
||||
object.put(TokenMode.REFRESH_TOKEN_KEY, token.getRefreshToken());
|
||||
object.put(TokenMode.SCOPE_KEY, token.getScope());
|
||||
object.put(TokenMode.TOKEN_TYPE_KEY, token.getTokenType());
|
||||
object.put(TokenMode.LAST_REFRESH_TIME_KEY, token.getLastRefreshTime());
|
||||
object.put(TokenMode.DATA_CENTER_KEY, token.getDataCenter());
|
||||
|
||||
return object;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* This class copies various methods from the URIUtil class in org.eclipse.equinox.common. Unless otherwise noted the
|
||||
* implementations here should mirror those in the common implementation.
|
||||
*/
|
||||
public class URIUtil {
|
||||
|
||||
public static final String SCHEME_FILE = "file"; //$NON-NLS-1$
|
||||
|
||||
private static final String UNC_PREFIX = "//"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Appends the given extension to the path of the give base URI and returns the corresponding new path.
|
||||
*
|
||||
* @param base The base URI to append to
|
||||
* @param extension The path extension to be added
|
||||
* @return The appended URI
|
||||
*/
|
||||
public static URI append(URI base, String extension) {
|
||||
try {
|
||||
String path = base.getPath();
|
||||
if (path == null)
|
||||
return appendOpaque(base, extension);
|
||||
// if the base is already a directory then resolve will just do the right thing
|
||||
if (path.endsWith("/")) {//$NON-NLS-1$
|
||||
URI result = base.resolve(extension);
|
||||
// Fix UNC paths that are incorrectly normalized by URI#resolve (see Java bug 4723726)
|
||||
String resultPath = result.getPath();
|
||||
if (path.startsWith(UNC_PREFIX) && (resultPath == null || !resultPath.startsWith(UNC_PREFIX)))
|
||||
result = new URI(result.getScheme(), "///" + result.getSchemeSpecificPart(), result.getFragment()); //$NON-NLS-1$
|
||||
return result;
|
||||
}
|
||||
path = path + "/" + extension; //$NON-NLS-1$
|
||||
return new URI(base.getScheme(), base.getUserInfo(), base.getHost(), base.getPort(), path, base.getQuery(),
|
||||
base.getFragment());
|
||||
} catch (URISyntaxException e) {
|
||||
// shouldn't happen because we started from a valid URI
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Special case of appending to an opaque URI. Since opaque URIs have no path segment the best we can do is append
|
||||
* to the scheme-specific part
|
||||
*/
|
||||
private static URI appendOpaque(URI base, String extension) throws URISyntaxException {
|
||||
String ssp = base.getSchemeSpecificPart();
|
||||
if (ssp.endsWith("/")) //$NON-NLS-1$
|
||||
ssp += extension;
|
||||
else
|
||||
ssp = ssp + "/" + extension; //$NON-NLS-1$
|
||||
return new URI(base.getScheme(), ssp, base.getFragment());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a URI corresponding to the given unencoded string.
|
||||
*
|
||||
* @throws URISyntaxException If the string cannot be formed into a valid URI
|
||||
*/
|
||||
public static URI fromString(String uriString) throws URISyntaxException {
|
||||
int colon = uriString.indexOf(':');
|
||||
int hash = uriString.lastIndexOf('#');
|
||||
boolean noHash = hash < 0;
|
||||
if (noHash)
|
||||
hash = uriString.length();
|
||||
String scheme = colon < 0 ? null : uriString.substring(0, colon);
|
||||
String ssp = uriString.substring(colon + 1, hash);
|
||||
String fragment = noHash ? null : uriString.substring(hash + 1);
|
||||
// use java.io.File for constructing file: URIs
|
||||
if (scheme != null && scheme.equals(SCHEME_FILE)) {
|
||||
File file = new File(uriString.substring(5));
|
||||
if (file.isAbsolute())
|
||||
return file.toURI();
|
||||
scheme = null;
|
||||
if (File.separatorChar != '/')
|
||||
ssp = ssp.replace(File.separatorChar, '/');
|
||||
}
|
||||
return new URI(scheme, ssp, fragment);
|
||||
}
|
||||
|
||||
/*
|
||||
* Compares two URI for equality. Return false if one of them is null
|
||||
*/
|
||||
public static boolean sameURI(URI url1, URI url2) {
|
||||
if (url1 == url2)
|
||||
return true;
|
||||
if (url1 == null || url2 == null)
|
||||
return false;
|
||||
if (url1.equals(url2))
|
||||
return true;
|
||||
|
||||
if (url1.isAbsolute() != url2.isAbsolute())
|
||||
return false;
|
||||
|
||||
// check if we have two local file references that are case variants
|
||||
File file1 = toFile(url1);
|
||||
return file1 == null ? false : file1.equals(toFile(url2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the URI as a local file, or <code>null</code> if the given URI does not represent a local file.
|
||||
*
|
||||
* @param uri The URI to return the file for
|
||||
* @return The local file corresponding to the given URI, or <code>null</code>
|
||||
*/
|
||||
public static File toFile(URI uri) {
|
||||
try {
|
||||
if (!SCHEME_FILE.equalsIgnoreCase(uri.getScheme()))
|
||||
return null;
|
||||
// assume all illegal characters have been properly encoded, so use URI class to unencode
|
||||
return new File(uri);
|
||||
} catch (IllegalArgumentException e) {
|
||||
// File constructor does not support non-hierarchical URI
|
||||
String path = uri.getPath();
|
||||
// path is null for non-hierarchical URI such as file:c:/tmp
|
||||
if (path == null)
|
||||
path = uri.getSchemeSpecificPart();
|
||||
return new File(path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of the given URI that doesn't have illegal characters encoded. This string is
|
||||
* suitable for later passing to {@link #fromString(String)}.
|
||||
*
|
||||
* @param uri The URI to convert to string format
|
||||
* @return An unencoded string representation of the URI
|
||||
*/
|
||||
public static String toUnencodedString(URI uri) {
|
||||
StringBuffer result = new StringBuffer();
|
||||
String scheme = uri.getScheme();
|
||||
if (scheme != null)
|
||||
result.append(scheme).append(':');
|
||||
// there is always a ssp
|
||||
result.append(uri.getSchemeSpecificPart());
|
||||
String fragment = uri.getFragment();
|
||||
if (fragment != null)
|
||||
result.append('#').append(fragment);
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the URL as a URI. This method will handle broken URLs that are not properly encoded (for example they
|
||||
* contain unencoded space characters).
|
||||
*/
|
||||
public static URI toURI(URL url) throws URISyntaxException {
|
||||
// URL behaves differently across platforms so for file: URLs we parse from string form
|
||||
if (SCHEME_FILE.equals(url.getProtocol())) {
|
||||
String pathString = url.toExternalForm().substring(5);
|
||||
// ensure there is a leading slash to handle common malformed URLs such as file:c:/tmp
|
||||
if (pathString.indexOf('/') != 0)
|
||||
pathString = '/' + pathString;
|
||||
else if (pathString.startsWith(UNC_PREFIX) && !pathString.startsWith(UNC_PREFIX, 2)) {
|
||||
// URL encodes UNC path with two slashes, but URI uses four (see bug 207103)
|
||||
pathString = UNC_PREFIX + pathString;
|
||||
}
|
||||
return new URI(SCHEME_FILE, null, pathString, null);
|
||||
}
|
||||
try {
|
||||
return new URI(url.toExternalForm());
|
||||
} catch (URISyntaxException e) {
|
||||
// try multi-argument URI constructor to perform encoding
|
||||
return new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), url.getQuery(),
|
||||
url.getRef());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a URI as a URL.
|
||||
*
|
||||
* @throws MalformedURLException
|
||||
*/
|
||||
public static URL toURL(URI uri) throws MalformedURLException {
|
||||
return new URL(uri.toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util.i18n;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* DOC zwzhao class global comment. Detailled comment
|
||||
*/
|
||||
public class Messages extends MessagesCore {
|
||||
|
||||
private static final String BUNDLE_NAME = "messages"; //$NON-NLS-1$
|
||||
|
||||
private static final String PLUGIN_ID = "org.talend.license.gui";
|
||||
|
||||
private static ResourceBundle resourceBundle = ResourceBundle.getBundle(BUNDLE_NAME);
|
||||
|
||||
/**
|
||||
* Returns the i18n formatted message for <i>key</i> in the class bundle.
|
||||
*
|
||||
* @param key - the key for the desired string
|
||||
* @return the string for the given key in the class resource bundle
|
||||
* @see MessagesCore#getString(String, ResourceBundle)
|
||||
*/
|
||||
public static String getString(String key) {
|
||||
return getString(key, PLUGIN_ID, resourceBundle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the i18n formatted message for <i>key</i> and <i>args</i> in the specified bundle.
|
||||
*
|
||||
* @param key - the key for the desired string
|
||||
* @param args - arg to include in the string
|
||||
* @return the string for the given key in the given resource bundle
|
||||
* @see MessagesCore#getString(String, ResourceBundle, Object[])
|
||||
*/
|
||||
public static String getString(String key, Object... args) {
|
||||
return getString(key, PLUGIN_ID, resourceBundle, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the i18n formatted message for <i>key</i> and <i>locale<i> in the class bundle.
|
||||
*
|
||||
* @param key - the key for the desired string
|
||||
* @param locale - the locale for which a resource bundle is desired
|
||||
* @return the string for the given key in the given locale resource bundle
|
||||
*/
|
||||
public static String getLocaleString(String key, Locale locale) {
|
||||
ResourceBundle resourceBundle = ResourceBundle.getBundle(BUNDLE_NAME, locale);
|
||||
return getString(key, PLUGIN_ID, resourceBundle);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util.i18n;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* DOC zwzhao class global comment. Detailled comment
|
||||
*/
|
||||
public abstract class MessagesCore {
|
||||
|
||||
public static final String KEY_NOT_FOUND_PREFIX = "!!!"; //$NON-NLS-1$
|
||||
|
||||
public static final String KEY_NOT_FOUND_SUFFIX = "!!!"; //$NON-NLS-1$
|
||||
|
||||
// add by wzhang for 13249, MessageFormat will not indicate {0} as i18n args if in couple single quotes.
|
||||
public static final String SINGLE_QUOTE = "'"; //$NON-NLS-1$
|
||||
|
||||
public static final String SINGLE_QUOTE_MUTI = "''"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Returns the i18n formatted message for <i>key</i> in the specified bundle.
|
||||
*
|
||||
* @param key - the key for the desired string
|
||||
* @param resourceBundle - the ResourceBundle to search in
|
||||
* @return the string for the given key in the given resource bundle
|
||||
*/
|
||||
public static String getString(String key, String pluginId, ResourceBundle resourceBundle) {
|
||||
if (resourceBundle == null) {
|
||||
return KEY_NOT_FOUND_PREFIX + key + KEY_NOT_FOUND_SUFFIX;
|
||||
}
|
||||
try {
|
||||
return resourceBundle.getString(key);
|
||||
|
||||
} catch (MissingResourceException e) {
|
||||
return KEY_NOT_FOUND_PREFIX + key + KEY_NOT_FOUND_SUFFIX;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the i18n formatted message for <i>key</i> and <i>args</i> in the specified bundle.
|
||||
*
|
||||
* @param key - the key for the desired string
|
||||
* @param resourceBundle - the ResourceBundle to search in
|
||||
* @param args - arg to include in the string
|
||||
* @return the string for the given key in the given resource bundle
|
||||
*/
|
||||
// modified by wzhang. add a pluginId parameter
|
||||
public static String getString(String key, String pluginId, ResourceBundle resourceBundle, Object... args) {
|
||||
try {
|
||||
return MessageFormat.format(getString(key, pluginId, resourceBundle).replaceAll(SINGLE_QUOTE, SINGLE_QUOTE_MUTI),
|
||||
args);
|
||||
} catch (Exception e) {
|
||||
return KEY_NOT_FOUND_PREFIX + key + KEY_NOT_FOUND_SUFFIX;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the i18n formatted message for <i>key</i> and <i>args</i> in the specified bundle.
|
||||
*
|
||||
* @param key - the key for the desired string
|
||||
* @param resourceBundle - the ResourceBundle to search in
|
||||
* @param args - arg to include in the string
|
||||
* @return the string for the given key in the given resource bundle
|
||||
* @deprecated
|
||||
*/
|
||||
public static String getString(String key, ResourceBundle resourceBundle, Object... args) {
|
||||
return getString(key, null, resourceBundle, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the i18n formatted message for <i>key</i> in the specified bundle.
|
||||
*
|
||||
* @param key - the key for the desired string
|
||||
* @param resourceBundle - the ResourceBundle to search in
|
||||
* @return the string for the given key in the given resource bundle
|
||||
* @deprecated
|
||||
*/
|
||||
public static String getString(String key, ResourceBundle resourceBundle) {
|
||||
return getString(key, null, resourceBundle);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.signon.util.listener;
|
||||
|
||||
public interface LoginEventListener {
|
||||
|
||||
public void loginStart();
|
||||
|
||||
public void loginStop(String authCode, String dataCenter);
|
||||
|
||||
public void loginFailed(Exception ex);
|
||||
|
||||
public String getCodeChallenge();
|
||||
}
|
||||
1
pom.xml
1
pom.xml
@@ -112,6 +112,7 @@
|
||||
<module>main/plugins/org.talend.themes.css.talend</module>
|
||||
<module>main/plugins/org.talend.designer.maven.tos/resources</module>
|
||||
<module>main/plugins/org.talend.designer.maven.tos</module>
|
||||
<module>main/plugins/org.talend.signon.util</module>
|
||||
|
||||
<module>main/plugins/org.talend.designer.maven.repo.tck</module>
|
||||
<module>main/plugins/org.talend.designer.maven.repo.tcksdk</module>
|
||||
|
||||
Reference in New Issue
Block a user