-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial implementation of a (very) basic auth screen (#1)
* More version catalogging * Add koin-android lib * Create new auth feature module * Temporarily wire up auth screen * Allow cleartext traffic to truenas.local * Add missing contentTypes * Add missing gitignores * Wire up auth screen to check credentials * String-ify * Create & use ApiStateProvider for storing auth token and base URL * Add Ktor logging * Fix for server address * Create token if username/password are valid * More fixes for base URL * No autocorrect for Uri * Wire up navigation
- Loading branch information
Showing
26 changed files
with
501 additions
and
66 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
app/src/main/java/com/boswelja/truemanager/MainApplication.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.boswelja.truemanager | ||
|
||
import android.app.Application | ||
import com.boswelja.truemanager.auth.authModule | ||
import com.boswelja.truemanager.core.api.v2.apiV2Module | ||
import org.koin.core.context.startKoin | ||
|
||
class MainApplication : Application() { | ||
|
||
override fun onCreate() { | ||
super.onCreate() | ||
|
||
startKoin { | ||
modules(apiV2Module) | ||
|
||
modules( | ||
authModule, | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<network-security-config> | ||
<domain-config cleartextTrafficPermitted="true"> | ||
<domain includeSubdomains="true">truenas.local</domain> | ||
</domain-config> | ||
</network-security-config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
core/api/src/main/kotlin/com/boswelja/truemanager/core/api/v2/ApiStateProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.boswelja.truemanager.core.api.v2 | ||
|
||
interface ApiStateProvider { | ||
var serverAddress: String? | ||
|
||
var sessionToken: String? | ||
} | ||
|
||
internal class InMemoryApiStateProvider : ApiStateProvider { | ||
override var serverAddress: String? = null | ||
set(value) { | ||
if (field != value) { | ||
if (value == null) { | ||
field = null | ||
return | ||
} | ||
|
||
field = "${value.removeSuffix("/")}/api/v2.0/" | ||
} | ||
} | ||
|
||
override var sessionToken: String? = null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.