Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 23050 Details for
Bug 78290
[FTP WebDAV] username not stored / asked for
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Modified org/eclipse/target/AuthenticatedSite.java
AuthenticatedSite.java (text/plain), 4.09 KB, created by
Olivier Oeuillot
on 2005-06-14 09:49:06 EDT
(
hide
)
Description:
Modified org/eclipse/target/AuthenticatedSite.java
Filename:
MIME Type:
Creator:
Olivier Oeuillot
Created:
2005-06-14 09:49:06 EDT
Size:
4.09 KB
patch
obsolete
>/******************************************************************************* > * Copyright (c) 2000, 2004 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 > * http://www.eclipse.org/legal/epl-v10.html > * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >package org.eclipse.target; > >import java.net.MalformedURLException; >import java.net.URL; >import java.util.HashMap; >import java.util.Map; > >import org.eclipse.core.runtime.CoreException; >import org.eclipse.core.runtime.IProgressMonitor; >import org.eclipse.core.runtime.Platform; >import org.eclipse.jface.util.Assert; >import org.eclipse.ui.IMemento; > >/** > * Convenience Site that caches a username and password in the Core keyring > * file. The keyring file is hard but not impossible to unscramble. Hence, this > * class should only be used in those cases where the username and password are > * not sensitive. > * <p> > * <b>Note:</b> This class/interface is part of an interim API that is still > * under development and expected to change significantly before reaching > * stability. It is being made available at this early stage to solicit feedback > * from pioneering adopters on the understanding that any code that uses this > * API will almost certainly be broken (repeatedly) as the API evolves. > * </p> > */ >public abstract class AuthenticatedSite extends Site { > > private String username; > > private String password; > > /** > * Return the location of this site in URL form. This method creates a URL > * from the location string obtained from {@link Site#getLocation()}. > * Subclasses must override if the location string is not a valid URL. > * > * @return the location of this site in URL form. > */ > public URL toUrl() { > try { > return new URL(getLocation()); > } catch (MalformedURLException e) { > Assert > .isTrue(false, > "The location of this site is not a valid URL"); //$NON-NLS-1$ > // This return statement is never reached > return null; > } > } > > /* > * (non-Javadoc) > * > * @see org.eclipse.target.Site#discarded() > */ > public void discarded() throws CoreException { > Platform.flushAuthorizationInfo(toUrl(), "", ""); //$NON-NLS-1$ //$NON-NLS-2$ > } > > /** > * Return the username used to connect ot this site. > * > * @return the username > */ > public String getUsername() { > return username; > } > > /** > * Return the password used to connect ot this site. > * > * @return the password > */ > public String getPassword() { > return password; > } > > /** > * Set the username used to connect to this site > * > * @param name > * the username > * @throws CoreException > */ > public void setUsername(String name) throws CoreException { > Map authInfo = Platform.getAuthorizationInfo(toUrl(), "", ""); //$NON-NLS-1$ //$NON-NLS-2$ > if (authInfo == null) > authInfo = new HashMap(2); > authInfo.put("name", name); //$NON-NLS-1$ > Platform.flushAuthorizationInfo(toUrl(), "", ""); //$NON-NLS-1$ //$NON-NLS-2$ > Platform.addAuthorizationInfo(toUrl(), "", "", authInfo); //$NON-NLS-1$ //$NON-NLS-2$ > this.username = name; > } > > /** > * Set the password used to connect to this site > * > * @param password > * the password > * @throws CoreException > */ > public void setPassword(String password) throws CoreException { > Map authInfo = Platform.getAuthorizationInfo(toUrl(), "", ""); //$NON-NLS-1$ //$NON-NLS-2$ > if (authInfo == null) > authInfo = new HashMap(2); > authInfo.put("password", password); //$NON-NLS-1${ > Platform.flushAuthorizationInfo(toUrl(), "", ""); //$NON-NLS-1$ //$NON-NLS-2$ > Platform.addAuthorizationInfo(toUrl(), "", "", authInfo); //$NON-NLS-1$ //$NON-NLS-2$ > this.password = password; > } > > protected void initializeAuthorization() { > Map infos = Platform.getAuthorizationInfo(toUrl(), "", ""); > if (infos != null) { > if (username == null && password == null) { > username = (String) infos.get("name"); > password = (String) infos.get("password"); > } > } > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 78290
:
23049
|
23050
|
23051
|
23053