mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2024-11-24 19:04:38 -06:00
[APIv2/Vulcan] Temporary fix for signing requests
This commit is contained in:
parent
25744037f5
commit
3540b09623
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
package pl.szczodrzynski.edziennik.api.v2.vulcan.data
|
package pl.szczodrzynski.edziennik.api.v2.vulcan.data
|
||||||
|
|
||||||
|
import android.util.Base64
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import im.wangchao.mhttp.Request
|
import im.wangchao.mhttp.Request
|
||||||
import im.wangchao.mhttp.Response
|
import im.wangchao.mhttp.Response
|
||||||
@ -16,6 +17,7 @@ import pl.szczodrzynski.edziennik.data.db.modules.teams.Team
|
|||||||
import pl.szczodrzynski.edziennik.utils.Utils
|
import pl.szczodrzynski.edziennik.utils.Utils
|
||||||
import pl.szczodrzynski.edziennik.utils.Utils.d
|
import pl.szczodrzynski.edziennik.utils.Utils.d
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
|
import java.io.ByteArrayInputStream
|
||||||
import java.net.HttpURLConnection
|
import java.net.HttpURLConnection
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@ -52,7 +54,7 @@ open class VulcanApi(open val data: DataVulcan) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val startDate = when(profile?.empty) {
|
val startDate = when (profile?.empty) {
|
||||||
true -> profile?.getSemesterStart(profile?.currentSemester ?: 1)?.stringY_m_d
|
true -> profile?.getSemesterStart(profile?.currentSemester ?: 1)?.stringY_m_d
|
||||||
else -> Date.getToday().stepForward(0, -1, 0).stringY_m_d
|
else -> Date.getToday().stepForward(0, -1, 0).stringY_m_d
|
||||||
}
|
}
|
||||||
@ -112,7 +114,9 @@ open class VulcanApi(open val data: DataVulcan) {
|
|||||||
.userAgent(VULCAN_API_USER_AGENT)
|
.userAgent(VULCAN_API_USER_AGENT)
|
||||||
.addHeader("RequestCertificateKey", data.apiCertificateKey)
|
.addHeader("RequestCertificateKey", data.apiCertificateKey)
|
||||||
.addHeader("RequestSignatureValue",
|
.addHeader("RequestSignatureValue",
|
||||||
signContent(VULCAN_API_PASSWORD, data.apiCertificatePfx, finalPayload.toString()))
|
Utils.VulcanRequestEncryptionUtils.signContent(
|
||||||
|
finalPayload.toString().toByteArray(),
|
||||||
|
ByteArrayInputStream(Base64.decode(data.apiCertificatePfx, Base64.DEFAULT))))
|
||||||
.apply {
|
.apply {
|
||||||
when (method) {
|
when (method) {
|
||||||
GET -> get()
|
GET -> get()
|
||||||
|
Loading…
Reference in New Issue
Block a user