-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from Liftric/feature/parse-id-token
feat(api): Get Claims from Id Token
- Loading branch information
Showing
12 changed files
with
166 additions
and
4 deletions.
There are no files selected for viewing
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
11 changes: 11 additions & 0 deletions
11
auth/src/androidMain/kotlin/com/liftric/auth/base/Base64.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,11 @@ | ||
package com.liftric.auth.base | ||
|
||
import android.util.Base64 | ||
|
||
internal actual class Base64 { | ||
actual companion object { | ||
actual fun decode(string: String): String? { | ||
return String(Base64.decode(string, Base64.URL_SAFE), Charsets.UTF_8) | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
auth/src/androidTest/kotlin/com/liftric/auth/AuthHandlerIntegrationTests.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,8 @@ | ||
package com.liftric.auth | ||
|
||
import androidx.test.core.app.ApplicationProvider | ||
import org.junit.runner.RunWith | ||
import org.robolectric.RobolectricTestRunner | ||
|
||
@RunWith(RobolectricTestRunner::class) | ||
actual class AuthHandlerIntegrationTests: AbstractAuthHandlerIntegrationTests() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.liftric.auth.base | ||
|
||
internal expect class Base64 { | ||
companion object { | ||
fun decode(string: String): String? | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.liftric.auth.base | ||
|
||
import platform.Foundation.NSData | ||
import platform.Foundation.NSString | ||
import platform.Foundation.NSUTF8StringEncoding | ||
import platform.Foundation.create | ||
|
||
internal actual class Base64 { | ||
actual companion object { | ||
actual fun decode(string: String): String? { | ||
var encoded64 = string | ||
val remainder = encoded64.count() % 4 | ||
if (remainder > 0) { | ||
encoded64 = encoded64.padEnd(string.count() + (4 - remainder), '=') | ||
} | ||
return NSData.create(encoded64, 0)?.let { | ||
(NSString.create(it, NSUTF8StringEncoding) as String?) | ||
}?: run { | ||
null | ||
} | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
auth/src/iosTest/kotlin/com/liftric/auth/AuthHandlerIntegrationTests.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,3 @@ | ||
package com.liftric.auth | ||
|
||
actual class AuthHandlerIntegrationTests: AbstractAuthHandlerIntegrationTests() |
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