Package org.openstreetmap.josm.io
Class OsmConnection
java.lang.Object
org.openstreetmap.josm.io.OsmConnection
- Direct Known Subclasses:
OsmApi,OsmServerReader
Base class that handles common things like authentication for the reader and writer
to the osm server.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceRetrieves OAuth access token. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected HttpClientprivate static final Stringprotected boolean(package private) static OsmConnection.OAuthAccessTokenFetcherprotected IOAuthParameters -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAuth(HttpClient connection) protected voidAdds an authentication header for basic authenticationprotected voidaddOAuth20AuthorizationHeader(HttpClient connection) Signs the connection with an OAuth authentication headervoidcancel()Cancels the connection.booleanReplies true if this connection is canceledprivate voidObtains an OAuth access token for the connection.protected StringRetrieves login from basic authentication header, if set.static voidSets the OAuth access token fetcher.
-
Field Details
-
BASIC_AUTH
- See Also:
-
cancel
-
activeConnection
-
oAuth20Parameters
-
fetcher
-
-
Constructor Details
-
OsmConnection
public OsmConnection()
-
-
Method Details
-
setOAuthAccessTokenFetcher
Sets the OAuth access token fetcher.- Parameters:
tokenFetcher- new OAuth access token fetcher. Cannot be null- Since:
- 12803
-
cancel
Cancels the connection. -
retrieveBasicAuthorizationLogin
Retrieves login from basic authentication header, if set.- Parameters:
con- the connection- Returns:
- login from basic authentication header, or
null - Throws:
OsmTransferException- if something went wrong. Check for nested exceptions- Since:
- 12992
-
addBasicAuthorizationHeader
Adds an authentication header for basic authentication- Parameters:
con- the connection- Throws:
OsmTransferException- if something went wrong. Check for nested exceptions
-
obtainOAuth20Token
Obtains an OAuth access token for the connection. Afterwards, the token is accessible viaOAuthAccessTokenHolder/CredentialsManager.- Throws:
MissingOAuthAccessTokenException- if the process cannot be completed successfully
-
addOAuth20AuthorizationHeader
Signs the connection with an OAuth authentication header- Parameters:
connection- the connection- Throws:
MissingOAuthAccessTokenException- if there is currently no OAuth Access Token configuredOsmTransferException- if signing fails
-
addAuth
- Throws:
OsmTransferException
-
isCanceled
Replies true if this connection is canceled- Returns:
- true if this connection is canceled
-