Skip to content

Commit

Permalink
Remove deprecated authentication code to fix build (api removed)
Browse files Browse the repository at this point in the history
  • Loading branch information
hb0 committed Oct 26, 2023
1 parent cf9688b commit d44b898
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 627 deletions.
76 changes: 0 additions & 76 deletions src/main/kotlin/de/cyface/uploader/Authenticator.kt

This file was deleted.

208 changes: 0 additions & 208 deletions src/main/kotlin/de/cyface/uploader/DefaultAuthenticator.kt

This file was deleted.

33 changes: 23 additions & 10 deletions src/main/kotlin/de/cyface/uploader/DefaultUploader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ import javax.net.ssl.SSLException
/**
* Implementation of the [Uploader].
*
* To use this interface just call [DefaultUploader.upload] with an authentication token, e.g. from
* [DefaultAuthenticator.authenticate].
* To use this interface just call [DefaultUploader.upload] with an authentication token.
*
* @author Armin Schnabel
* @version 1.0.0
Expand Down Expand Up @@ -197,7 +196,7 @@ class DefaultUploader(private val apiEndpoint: String) : Uploader {
}

override fun endpoint(): URL {
return URL(DefaultAuthenticator.returnUrlWithTrailingSlash(apiEndpoint) + "measurements")
return URL(returnUrlWithTrailingSlash(apiEndpoint) + "measurements")
}

@Throws(
Expand Down Expand Up @@ -344,6 +343,20 @@ class DefaultUploader(private val apiEndpoint: String) : Uploader {
*/
private const val PAYLOAD_TOO_LARGE = 413

/**
* Adds a trailing slash to the server URL or leaves an existing trailing slash untouched.
*
* @param url The url to format.
* @return The server URL with a trailing slash.
*/
private fun returnUrlWithTrailingSlash(url: String): String {
return if (url.endsWith("/")) {
url
} else {
"$url/"
}
}

/**
* Assembles a `HttpContent` object which contains the metadata.
*
Expand All @@ -355,14 +368,14 @@ class DefaultUploader(private val apiEndpoint: String) : Uploader {

// Location meta data
if (metaData.startLocation != null) {
attributes["startLocLat"] = metaData.startLocation.latitude.toString()
attributes["startLocLon"] = metaData.startLocation.longitude.toString()
attributes["startLocTS"] = metaData.startLocation.timestamp.toString()
attributes["startLocLat"] = metaData.startLocation!!.latitude.toString()
attributes["startLocLon"] = metaData.startLocation!!.longitude.toString()
attributes["startLocTS"] = metaData.startLocation!!.timestamp.toString()
}
if (metaData.endLocation != null) {
attributes["endLocLat"] = metaData.endLocation.latitude.toString()
attributes["endLocLon"] = metaData.endLocation.longitude.toString()
attributes["endLocTS"] = metaData.endLocation.timestamp.toString()
attributes["endLocLat"] = metaData.endLocation!!.latitude.toString()
attributes["endLocLon"] = metaData.endLocation!!.longitude.toString()
attributes["endLocTS"] = metaData.endLocation!!.timestamp.toString()
}
attributes["locationCount"] = metaData.locationCount.toString()

Expand All @@ -373,7 +386,7 @@ class DefaultUploader(private val apiEndpoint: String) : Uploader {
attributes["osVersion"] = metaData.operatingSystemVersion
attributes["appVersion"] = metaData.applicationVersion
attributes["length"] = metaData.length.toString()
attributes["modality"] = metaData.modality.toString()
attributes["modality"] = metaData.modality
attributes["formatVersion"] = metaData.formatVersion.toString()
attributes["logCount"] = metaData.logCount.toString()
attributes["imageCount"] = metaData.imageCount.toString()
Expand Down
Loading

0 comments on commit d44b898

Please sign in to comment.