From 21506cdf73ecadc335e37b3147fb13441d2cd2d4 Mon Sep 17 00:00:00 2001 From: Bernd Hufmann Date: Thu, 12 Mar 2015 21:39:43 -0400 Subject: [PATCH] Bug 461520: Implement service for user authentication Change-Id: I6089e1f7012136aa439cdc3456f18f9b8a530e7f Signed-off-by: Bernd Hufmann --- bundles/org.eclipse.remote.jsch.ui/plugin.xml | 5 +++++ .../internal/jsch/ui/JSchUserAuthenticator.java | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.remote.jsch.ui/plugin.xml b/bundles/org.eclipse.remote.jsch.ui/plugin.xml index d25045b6819..cee211b4d54 100644 --- a/bundles/org.eclipse.remote.jsch.ui/plugin.xml +++ b/bundles/org.eclipse.remote.jsch.ui/plugin.xml @@ -46,6 +46,11 @@ factory="org.eclipse.remote.internal.jsch.ui.JSchUIFileService$Factory" service="org.eclipse.remote.ui.IRemoteUIFileService"> + + diff --git a/bundles/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/JSchUserAuthenticator.java b/bundles/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/JSchUserAuthenticator.java index 646fa3a303d..ec78a40ba60 100644 --- a/bundles/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/JSchUserAuthenticator.java +++ b/bundles/org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/JSchUserAuthenticator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014 IBM Corporation and others. + * Copyright (c) 2014, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - Initial API and implementation + * Bernd Hufmann - Implement IRemoteConnection.Service.Factory *******************************************************************************/ package org.eclipse.remote.internal.jsch.ui; @@ -105,4 +106,16 @@ public class JSchUserAuthenticator implements IUserAuthenticatorService { } return display; } + + public static class Factory implements IRemoteConnection.Service.Factory { + @Override + @SuppressWarnings("unchecked") + public T getService(IRemoteConnection connection, Class service) { + if (IUserAuthenticatorService.class.equals(service)) { + return (T) new JSchUserAuthenticator(connection); + } else { + return null; + } + } + } }