Compare commits

...

73 Commits

Author SHA1 Message Date
jding-tlnd
20bc8abd33 Merge remote-tracking branch 'origin/maintenance/8.0' into jding/TUP-35523_test 2022-08-29 20:00:52 +08:00
jding-tlnd
22960dae1d feat(TUP-35523):SSO pendo tracking
https://jira.talendforge.org/browse/TUP-35523
2022-08-29 16:23:35 +08:00
jding-tlnd
1b07c3c71d feat(TUP-35523):SSO pendo tracking
https://jira.talendforge.org/browse/TUP-35523
2022-08-29 16:20:04 +08:00
jding-tlnd
dce6c39cf0 Merge remote-tracking branch 'origin/kjwang/Feat_TUP-32606_Support_SSO_on_Studio' into jding/TUP-35523_SSO_pendo_tracking 2022-08-29 15:31:19 +08:00
kjwang-talend
9ef805a02b Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-08-29 09:45:43 +08:00
kjwang-talend
31b68cfdc7 temp commit 2022-08-19 20:53:01 +08:00
jding-tlnd
6681d6da80 feat(TUP-35523):SSO pendo tracking
https://jira.talendforge.org/browse/TUP-35523
2022-08-19 18:16:29 +08:00
kjwang-talend
f18d8d6873 temp commit 2022-08-17 18:48:14 +08:00
kjwang-talend
f6925636a6 temp commit 2022-08-17 11:47:29 +08:00
kjwang-talend
7b800907cd temp commit 2022-08-16 11:37:31 +08:00
kjwang-talend
9c6e1c01df temp commit 2022-08-15 18:34:31 +08:00
kjwang-talend
8e886ba263 temp commit 2022-08-12 19:18:41 +08:00
kjwang-talend
65edd66fa4 temp commit 2022-08-12 17:38:31 +08:00
kjwang-talend
702834f478 Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-08-11 18:59:37 +08:00
kjwang-talend
de883a38a8 temp commit 2022-08-10 18:56:00 +08:00
kjwang-talend
1631720240 temp commit 2022-08-10 12:00:14 +08:00
kjwang-talend
f274a32038 Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-08-10 11:47:22 +08:00
kjwang-talend
a2174d727d temp commit 2022-08-10 11:42:15 +08:00
kjwang-talend
c6b96daf93 Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-08-09 09:27:24 +08:00
kjwang-talend
6458c668c0 temp commit 2022-08-08 18:23:47 +08:00
kjwang-talend
af088f8b77 temp commit 2022-08-04 20:07:44 +08:00
kjwang-talend
908397e237 temp commit 2022-08-04 16:27:03 +08:00
kjwang-talend
84ab54e3bc temp commit 2022-08-03 19:17:27 +08:00
kjwang-talend
bd325c25ca temp commit 2022-08-03 17:54:05 +08:00
kjwang-talend
83424e0bfe Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-08-03 12:03:26 +08:00
kjwang-talend
35b76480d2 temp commit 2022-08-03 12:01:32 +08:00
kjwang-talend
2334fe101d Temp commit 2022-07-28 18:21:24 +08:00
kjwang-talend
d0620ccc8c temp commit 2022-07-27 15:54:34 +08:00
kjwang-talend
7b48310e61 Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-07-25 16:25:44 +08:00
kjwang-talend
72092ab66d temp commit 2022-06-15 18:51:14 +08:00
kjwang-talend
306d98aaae Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-06-14 18:26:01 +08:00
kjwang-talend
8201c7818f Fix continue session issue 2022-06-14 17:55:20 +08:00
kjwang-talend
da623b1b42 Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-06-11 18:52:15 +08:00
kjwang-talend
284a837d19 temp commit 2022-06-11 18:24:06 +08:00
kjwang-talend
81788c0666 temp commit 2022-06-11 16:21:29 +08:00
kjwang-talend
33ce610109 temp commit 2022-06-09 18:26:37 +08:00
kjwang-talend
b1fa13b7b7 temp commit 2022-06-08 19:01:41 +08:00
kjwang-talend
18c71f042a temp commit 2022-06-08 18:28:18 +08:00
kjwang-talend
5c33ff4e61 Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-06-08 11:19:07 +08:00
kjwang-talend
8467406a05 temp commit 2022-06-07 19:05:27 +08:00
kjwang-talend
c2edc2c5fd temp commit 2 2022-05-28 11:47:41 +08:00
kjwang-talend
a5cc37c009 temp commit 2 2022-05-27 19:00:38 +08:00
kjwang-talend
f1ca94b489 temp commit 2 2022-05-27 18:33:48 +08:00
kjwang-talend
2ef9302aee temp commit 2 2022-05-27 17:50:37 +08:00
kjwang-talend
49915c6988 temp commit2 2022-05-27 17:02:19 +08:00
kjwang-talend
2bc89a95a2 temp commit 2 2022-05-27 17:01:58 +08:00
kjwang-talend
17f0b91204 temp commit 2022-05-27 11:43:42 +08:00
kjwang-talend
d4cad98307 temp commit 2022-05-26 11:41:34 +08:00
kjwang-talend
e632add200 temp commit 2022-05-26 10:32:02 +08:00
kjwang-talend
55ba970aa5 temp commit 2022-05-25 18:53:45 +08:00
kjwang-talend
f0a2b8c5a9 temp commit 2022-05-25 16:22:56 +08:00
kjwang-talend
55cf8b822a temp commit 2022-05-25 11:50:00 +08:00
kjwang-talend
ace4c7ae1a temp commit 2022-05-23 19:21:50 +08:00
kjwang-talend
55c1e5705d temp commit 2022-05-20 19:24:13 +08:00
kjwang-talend
938ed7d657 temp commit 2022-05-20 12:04:32 +08:00
kjwang-talend
ae64cbd608 Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-05-19 18:36:53 +08:00
kjwang-talend
27f4d567ba temp commit 2022-05-19 17:36:48 +08:00
kjwang-talend
96653db1db temp commit 2022-05-19 17:18:48 +08:00
kjwang-talend
2f574219aa temp commit 2022-05-19 15:52:06 +08:00
kjwang-talend
156c93fd6d temp commit 2022-05-19 10:14:03 +08:00
kjwang-talend
4c29d7366e List project 2022-05-18 18:17:40 +08:00
kjwang-talend
53abd2c9a1 temp commit 2022-05-17 22:42:26 +08:00
kjwang-talend
245df26f6f Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-05-17 21:17:16 +08:00
kjwang-talend
86615e45f4 temp commit 2022-05-17 20:09:41 +08:00
kjwang-talend
13fb3878d0 temp commit 2022-05-17 19:52:57 +08:00
kjwang-talend
135f60ddcf temp commit 2022-05-17 19:50:39 +08:00
kjwang-talend
f40e0fe89f Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-05-13 09:20:20 +08:00
kjwang-talend
ea59b0dd7d Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-05-12 19:08:58 +08:00
kjwang-talend
70705d3d4b Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-05-11 18:07:25 +08:00
kjwang-talend
25e2c4011d Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-05-10 09:35:26 +08:00
kjwang-talend
588901b430 temp commit 2022-05-09 19:24:06 +08:00
kjwang-talend
7cadac34f1 Merge remote-tracking branch 'origin/maintenance/8.0' into kjwang/Feat_TUP-32606_Support_SSO_on_Studio 2022-05-07 10:07:43 +08:00
kjwang-talend
ef62f63353 Temp commit 2022-05-05 15:11:08 +08:00
35 changed files with 1791 additions and 16 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

View File

@@ -151,7 +151,9 @@ public enum EImage implements IImage {
OPEN_DATA_PREP("/icons/favicon.png"),
CHESS_GRAY("/icons/gray.gif"); //$NON-NLS-1$
CHESS_GRAY("/icons/gray.gif"), //$NON-NLS-1$
MANAGE_CONNECTION("/icons/manage_connection.gif");
private String path;

View File

@@ -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: .,

View File

@@ -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;
}

View File

@@ -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,10 +244,10 @@ public class ConnectionBean implements Cloneable {
* @return the user
*/
public String getUser() {
try {
try {
if (conDetails.has(USER)) {
String user = conDetails.getString(USER);
if (isToken()) {
if (isToken() && StringUtils.isEmpty(user)) {
String url = getDynamicFields().get(RepositoryConstants.REPOSITORY_URL);
user = PendoTrackSender.getInstance().getTmcUser(url, getPassword());
if (StringUtils.isNotBlank(user)) {
@@ -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);
}
}
}

View File

@@ -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);
}

View File

@@ -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;
}
}

View File

@@ -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

View File

@@ -0,0 +1,57 @@
// ============================================================================
//
// 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.core.model.general.ConnectionBean;
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();
void lastConnectionChanged(ConnectionBean bean);
public void showReloginDialog();
public boolean isReloginDialogRunning();
public static ICloudSignOnService get() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICloudSignOnService.class)) {
return GlobalServiceRegister.getDefault().getService(ICloudSignOnService.class);
}
return null;
}
}

View File

@@ -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,7 @@ public class ConnectionUserPerReader {
} catch (Exception e) {
e.printStackTrace();
}
ICloudSignOnService.get().lastConnectionChanged(bean);
}
public void createPropertyFile() {

View File

@@ -36,7 +36,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.talend.core.runtime,
org.eclipse.e4.ui.workbench,
javax.inject,
org.eclipse.m2e.core
org.eclipse.m2e.core,
org.talend.singlesignon.client
Eclipse-LazyStart: true
Export-Package: org.talend.rcp,
org.talend.rcp.intro,

View File

@@ -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)) {

View File

@@ -32,6 +32,7 @@ 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;
@@ -139,16 +140,23 @@ public class ApplicationWorkbenchAdvisor extends IDEWorkbenchAdvisor {
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;
}
}

View 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>

View 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>

View 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;bundle-version="8.0.1",
org.apache.log4j;bundle-version="1.2.19",
org.eclipse.osgi,
org.eclipse.equinox.common,
org.eclipse.core.runtime

View File

@@ -0,0 +1 @@
jarprocessor.exclude.children=true

View File

@@ -0,0 +1,8 @@
source.. = src/main/java/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
schema/,\
lib/commons-exec.jar

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
</plugin>

View 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>

View File

@@ -0,0 +1,6 @@
TMCRepositoryUtil.ap.displayName=Asia Pacific on AWS
TMCRepositoryUtil.au.displayName=Australia on AWS
TMCRepositoryUtil.eu.displayName=Europe on AWS
TMCRepositoryUtil.us.displayName=United States - East on AWS
TMCRepositoryUtil.us-west.displayName=United States - West on Azure
SSOClientExec.error.timeout=Timeout waiting for login

View File

@@ -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());
}
}

View File

@@ -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;
}
}

View File

@@ -0,0 +1,118 @@
// ============================================================================
//
// 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.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 static final int EXIT_BY_TIMEOUT = -99;
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);
cmdLine.addArgument(getInvokeParameter(clientId, port));
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(600000);
executor.setWatchdog(executeWatchdog);
executor.setExitValues(new int[] { 0, 24 });
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;
if (EXIT_BY_TIMEOUT == exitValue) {
LOGGER.error("SSO client exited by timeout.");
listener.loginFailed(new Exception(Messages.getString("SSOClientExec.error.timeout")));
} else {
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;
}
}

View File

@@ -0,0 +1,121 @@
// ============================================================================
//
// 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 installFileName = "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 (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()) {
targetFolder.delete();
LOGGER.info("Deleted target folder:" + targetFolder.getAbsolutePath());
}
targetFolder.mkdirs();
LOGGER.info("Created target folder:" + targetFolder.getAbsolutePath());
FilesUtils.unzip(sourceFile.getAbsolutePath(), targetFolder.getAbsolutePath(), true);
LOGGER.info("Installed login 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, "repository");
File installFile = new File(folder, installFileName);
return installFile;
}
return null;
}
}

View File

@@ -0,0 +1,206 @@
// ============================================================================
//
// 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 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);
}
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.info(ex);
}
}
}
private void fireLoginStart() {
for (LoginEventListener l : listenerSet) {
try {
l.loginStart();
} catch (Exception ex) {
LOGGER.info(ex);
}
}
}
private void fireLoginFailed(Exception ex) {
for (LoginEventListener l : listenerSet) {
try {
l.loginFailed(ex);
} catch (Exception e) {
LOGGER.info(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);
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();
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;
}
}

View File

@@ -0,0 +1,145 @@
// ============================================================================
//
// 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.log4j.Logger;
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";
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();
LOGGER.info("Prepare to start login cloud client monitor");
SSOClientMonitor signOnClientListener = SSOClientMonitor.getInscance();
signOnClientListener.addLoginEventListener(listener);
new Thread(signOnClientListener).start();
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.");
}
LOGGER.info("Prepare to start cloud client on " + signOnClientListener.getListenPort());
signOnClientExec = new SSOClientExec(execFile, clientId, codeChallenge, signOnClientListener.getListenPort(), listener);
new Thread(signOnClientExec).start();
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(clientID).append("&");
urlSB.append("redirect_uri=").append(URLEncoder.encode(TMCRepositoryUtil.getRedirectURL(dataCenter), StandardCharsets.UTF_8.name())).append("&");
urlSB.append("scope=openid refreshToken&");
urlSB.append("response_type=code&");
urlSB.append("code_challenge_method=S256&");
urlSB.append("code_challenge=").append(codeChallenge).append("&");
urlSB.append("state=").append(callbackPort).append(SSOUtil.STATE_PARAM_SEPARATOR).append(TMCRepositoryUtil.getDefaultDataCenter());
return urlSB.toString();
}
}

View File

@@ -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);
}
}

View File

@@ -0,0 +1,102 @@
// ============================================================================
//
// 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.signon.util.i18n.Messages;
public class TMCRepositoryUtil {
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_CUSTOM_ID = "cloud_custom"; //$NON-NLS-1$
public static String getBaseLoginURL(String dataCenter) {
if (dataCenter == null) {
dataCenter = TMCRepositoryUtil.getDefaultDataCenter();
}
return "https://iam." + dataCenter + ".cloud.talend.com/oidc/idp/authorize";
}
public static String getDefaultDataCenter() {
String defaultDataCenter = "us";
if (System.getProperty(SSOClientUtil.DATA_CENTER_KEY) != null) {
defaultDataCenter = System.getProperty(SSOClientUtil.DATA_CENTER_KEY);
}
return defaultDataCenter;
}
public static String getCloudAdminURL(String dataCenter) {
return "https://tmc." + dataCenter + ".cloud.talend.com/studio_cloud_connection";
}
public static String getTokenURL(String dataCenter) {
return "https://iam." + dataCenter + ".cloud.talend.com/oidc/oauth2/token";
}
public static String getRedirectURL(String dataCenter) {
if (dataCenter == null) {
dataCenter = getDefaultDataCenter();
}
return "https://iam." + dataCenter + ".cloud.talend.com/idp/login-sso-success";
}
public static String getDisplayNameByDatacenter(String dataCenter) {
if ("ap".equals(dataCenter)) {
return Messages.getString("TMCRepositoryUtil.ap.displayName");
}
if ("us".equals(dataCenter)) {
return Messages.getString("TMCRepositoryUtil.us.displayName");
}
if ("us-west".equals(dataCenter)) {
return Messages.getString("TMCRepositoryUtil.us-west.displayName");
}
if ("eu".equals(dataCenter)) {
return Messages.getString("TMCRepositoryUtil.eu.displayName");
}
if ("au".equals(dataCenter)) {
return Messages.getString("TMCRepositoryUtil.au.displayName");
}
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;
}
}

View File

@@ -0,0 +1,163 @@
// ============================================================================
//
// 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));
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;
}
public boolean isExpired() {
return false;
}
}

View File

@@ -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());
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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();
}

View File

@@ -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>