diff --git a/MobileAuthApp/app/src/main/AndroidManifest.xml b/MobileAuthApp/app/src/main/AndroidManifest.xml
index d13134c..e9b29ca 100644
--- a/MobileAuthApp/app/src/main/AndroidManifest.xml
+++ b/MobileAuthApp/app/src/main/AndroidManifest.xml
@@ -3,6 +3,7 @@
package="com.tarkvaraprojekt.mobileauthapp">
+
+ @POST("auth/authentication")
+ suspend fun postToken(@Body data: TokenItem): Response
}
object TokenApi {
diff --git a/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/network/TokenItem.kt b/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/network/TokenItem.kt
new file mode 100644
index 0000000..b7bb0c1
--- /dev/null
+++ b/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/network/TokenItem.kt
@@ -0,0 +1,9 @@
+package com.tarkvaraprojekt.mobileauthapp.network
+
+/**
+ * TokenItem for making POST request.
+ */
+data class TokenItem (
+ val token: String,
+ val challenge: String,
+)
\ No newline at end of file
diff --git a/README.md b/README.md
index 9803eda..cccf57d 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@ More info about installing third party applications on the Android phones: https
### Wiki pages relevant for the "Software project" subject
* [Project Vision](https://github.com/TanelOrumaa/Estonian-ID-card-mobile-authenticator-POC/wiki/Project-Vision) *last updated on 10.10*
-* [Release Notes](https://github.com/TanelOrumaa/Estonian-ID-card-mobile-authenticator-POC/wiki/Release-notes) *last updated for iteration 2 on 10.10*
+* [Release Notes](https://github.com/TanelOrumaa/Estonian-ID-card-mobile-authenticator-POC/wiki/Release-notes) *last updated for iteration3 on 08.11*
* [Project tasks](https://tvp-mobile-authentication.atlassian.net/jira/software/projects/MOB/boards/1/backlog) (Ask Tanel for JIRA permissions if needed).
* [Project plan](https://github.com/TanelOrumaa/Estonian-ID-card-mobile-authenticator-POC/wiki/Project-plan) *last updated on 10.10*
* [Use Cases](https://github.com/TanelOrumaa/Estonian-ID-card-mobile-authenticator-POC/wiki/Use-Cases) *last updated on 10.10*
diff --git a/TestMobileApp/app/src/main/java/com/example/testmobileapp/MainActivity.kt b/TestMobileApp/app/src/main/java/com/example/testmobileapp/MainActivity.kt
index 8d9e9e0..4184aad 100644
--- a/TestMobileApp/app/src/main/java/com/example/testmobileapp/MainActivity.kt
+++ b/TestMobileApp/app/src/main/java/com/example/testmobileapp/MainActivity.kt
@@ -35,17 +35,20 @@ class MainActivity : AppCompatActivity() {
}
binding.loginOptionNfcButton.setOnClickListener { launchAuth() }
+ //binding.loginOptionNfcButton.setOnClickListener { getData() }
}
/**
* Method that creates an intent to launch the MobileAuthApp
*/
- private fun launchAuth(arg: String = "nothing") {
+ private fun launchAuth(challenge: String = "challenge", authUrl: String = "authUrl") {
val launchIntent = Intent()
launchIntent.setClassName("com.tarkvaraprojekt.mobileauthapp", "com.tarkvaraprojekt.mobileauthapp.MainActivity")
- launchIntent.putExtra("auth", true)
- launchIntent.putExtra("nonce", arg) // Currently nothing
+ launchIntent.putExtra("action", "auth")
+ launchIntent.putExtra("challenge", challenge)
+ launchIntent.putExtra("authUrl", authUrl)
+ launchIntent.putExtra("mobile", true)
authLauncher.launch(launchIntent)
}
@@ -54,14 +57,17 @@ class MainActivity : AppCompatActivity() {
* Ion library is used as it is very convenient for making simple GET requests.
*/
private fun getData() {
- val url = "real-address-here"
+ // Enter the server endpoint address to here
+ val baseUrl = "enter-base-url-here"
+ val url = "$baseUrl/auth/challenge"
Ion.with(applicationContext)
.load(url)
.asJsonObject()
.setCallback { _, result ->
try {
// Get data from the result and call launchAuth method
- launchAuth()
+ val challenge = result.asJsonObject["nonce"].toString()
+ launchAuth(challenge, baseUrl)
} catch (e: Exception) {
Log.i("GETrequest", "was unsuccessful")
}