source: josm/trunk/src/org/openstreetmap/josm/io/auth/CredentialsAgent.java@ 8929

Last change on this file since 8929 was 8929, checked in by Don-vip, 8 years ago

javadoc fixes

  • Property svn:eol-style set to native
File size: 3.5 KB
RevLine 
[1958]1// License: GPL. For details, see LICENSE file.
[2641]2package org.openstreetmap.josm.io.auth;
[1958]3
[4249]4import java.awt.Component;
[6830]5import java.net.Authenticator.RequestorType;
[2641]6import java.net.PasswordAuthentication;
[1958]7
[2748]8import org.openstreetmap.josm.data.oauth.OAuthToken;
9
[1958]10/**
[4245]11 * A CredentialsAgent manages two credentials:
[2641]12 * <ul>
[5266]13 * <li>the credential for {@link RequestorType#SERVER} which is equal to the OSM API credentials
[2641]14 * in JOSM</li>
[5266]15 * <li>the credential for {@link RequestorType#PROXY} which is equal to the credentials for an
[2641]16 * optional HTTP proxy server a user may use</li>
17 * </ul>
[2801]18 *
[2748]19 * In addition, it manages an OAuth Access Token for accessing the OSM server.
[1958]20 */
[4245]21public interface CredentialsAgent {
[2512]22
[1958]23 /**
[2641]24 * Looks up the credentials for a given type.
[2711]25 *
[5836]26 * @param requestorType the type of service. {@link RequestorType#SERVER} for the OSM API server, {@link RequestorType#PROXY}
[2641]27 * for a proxy server
[5836]28 * @param host the hostname for these credentials
[2641]29 * @return the credentials
[8291]30 * @throws CredentialsAgentException if a problem occurs in a implementation of this interface
[1958]31 */
[4690]32 PasswordAuthentication lookup(RequestorType requestorType, String host) throws CredentialsAgentException;
[1958]33
34 /**
[2641]35 * Saves the credentials in <code>credentials</code> for the given service type.
[2711]36 *
[5836]37 * @param requestorType the type of service. {@link RequestorType#SERVER} for the OSM API server, {@link RequestorType#PROXY}
[2641]38 * for a proxy server
[5836]39 * @param host the hostname for these credentials
[2641]40 * @param credentials the credentials
[8291]41 * @throws CredentialsAgentException if a problem occurs in a implementation of this interface
[1958]42 */
[4690]43 void store(RequestorType requestorType, String host, PasswordAuthentication credentials) throws CredentialsAgentException;
[1958]44
45 /**
[8929]46 * Returns the credentials needed to to access host.
[5836]47 * @param requestorType the type of service. {@link RequestorType#SERVER} for the OSM API server, {@link RequestorType#PROXY}
[2641]48 * for a proxy server
[5836]49 * @param host the hostname for these credentials
[2641]50 * @param noSuccessWithLastResponse true, if the last request with the supplied credentials failed; false otherwise.
[4245]51 * If true, implementations of this interface are advised to prompt the user for new credentials.
[8929]52 * @return the credentials
[8291]53 * @throws CredentialsAgentException if a problem occurs in a implementation of this interface
[1958]54 */
[8509]55 CredentialsAgentResponse getCredentials(RequestorType requestorType, String host, boolean noSuccessWithLastResponse)
56 throws CredentialsAgentException;
[2748]57
58 /**
59 * Lookup the current OAuth Access Token to access the OSM server. Replies null, if no
[4245]60 * Access Token is currently managed by this CredentialAgent.
[2801]61 *
[2748]62 * @return the current OAuth Access Token to access the OSM server.
[8291]63 * @throws CredentialsAgentException if something goes wrong
[2748]64 */
[4249]65 OAuthToken lookupOAuthAccessToken() throws CredentialsAgentException;
[2748]66
67 /**
68 * Stores the OAuth Access Token <code>accessToken</code>.
[2801]69 *
[2748]70 * @param accessToken the access Token. null, to remove the Access Token.
[8291]71 * @throws CredentialsAgentException if something goes wrong
[2748]72 */
[4249]73 void storeOAuthAccessToken(OAuthToken accessToken) throws CredentialsAgentException;
74
75 /**
76 * Provide a Panel that is shown below the API password / username fields
77 * in the JOSM Preferences. (E.g. a warning that password is saved unencrypted.)
[8929]78 * @return Panel
[4249]79 */
80 Component getPreferencesDecorationPanel();
[1958]81}
Note: See TracBrowser for help on using the repository browser.