Archived
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1baf543139 |
No files matched your search
@@ -51,7 +51,6 @@ jobs:
|
|||||||
pnpm i
|
pnpm i
|
||||||
npm config set @${{ needs.persiapan.outputs.organisasi }}:registry=https://${{ vars.ALAMAT_GITEA }}/api/packages/${{ needs.persiapan.outputs.organisasi }}/npm/
|
npm config set @${{ needs.persiapan.outputs.organisasi }}:registry=https://${{ vars.ALAMAT_GITEA }}/api/packages/${{ needs.persiapan.outputs.organisasi }}/npm/
|
||||||
npm config set -- '//${{ vars.ALAMAT_GITEA }}/api/packages/${{ needs.persiapan.outputs.organisasi }}/npm/:_authToken' "${{ secrets.KUNCI_PENERBITAN }}"
|
npm config set -- '//${{ vars.ALAMAT_GITEA }}/api/packages/${{ needs.persiapan.outputs.organisasi }}/npm/:_authToken' "${{ secrets.KUNCI_PENERBITAN }}"
|
||||||
npm run prepublishOnly
|
|
||||||
npm publish
|
npm publish
|
||||||
rm -rf pnpm-lock.yaml .pnpm-store/
|
rm -rf pnpm-lock.yaml .pnpm-store/
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tauri-plugin-auth"
|
name = "tauri-plugin-auth"
|
||||||
version = "0.1.8"
|
version = "0.1.0"
|
||||||
authors = [ "Rizky Denianto" ]
|
authors = [ "Rizky Denianto" ]
|
||||||
description = "Program sederhana untuk interaksi dengan autentikasi aplikasi tauri di berbagai sistem operasi"
|
description = "Program sederhana untuk interaksi dengan autentikasi aplikasi tauri di berbagai sistem operasi"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|||||||
@@ -1,3 +1,2 @@
|
|||||||
# tauri-plugin-auth
|
# tauri-plugin-auth
|
||||||
|
|
||||||
Program sederhana untuk interaksi dengan autentikasi aplikasi tauri di berbagai sistem operasi
|
|
||||||
@@ -42,7 +42,7 @@ dependencies {
|
|||||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
|
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
|
||||||
implementation(project(":tauri-android"))
|
implementation(project(":tauri-android"))
|
||||||
|
|
||||||
implementation("androidx.credentials:credentials:1.5.0")
|
implementation("androidx.credentials:credentials:1.7.0-alpha03")
|
||||||
implementation("androidx.credentials:credentials-play-services-auth:1.5.0")
|
implementation("androidx.credentials:credentials-play-services-auth:1.7.0-alpha03")
|
||||||
implementation("com.google.android.libraries.identity.googleid:googleid:1.1.1")
|
implementation("com.google.android.libraries.identity.googleid:googleid:<latest version>")
|
||||||
}
|
}
|
||||||
@@ -28,26 +28,27 @@ import java.security.SecureRandom
|
|||||||
|
|
||||||
@InvokeArg
|
@InvokeArg
|
||||||
class KirimArgs {
|
class KirimArgs {
|
||||||
var id: String? = null
|
var idKlien: String? = null
|
||||||
}
|
}
|
||||||
|
|
||||||
@TauriPlugin
|
@TauriPlugin
|
||||||
class AuthPlugin(private val activity: Activity) : Plugin(activity) {
|
class BluclasPlugin(private val activity: Activity) : Plugin(activity) {
|
||||||
private val credentialManager by lazy { CredentialManager.create(activity) }
|
private val credentialManager by lazy { CredentialManager.create(activity) }
|
||||||
private val scope = CoroutineScope(Dispatchers.Main)
|
private val scope = CoroutineScope(Dispatchers.Main)
|
||||||
|
private val idKlien: String? = null
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
fun masuk(invoke: Invoke) {
|
fun masuk(invoke: Invoke) {
|
||||||
val args = invoke.parseArgs(KirimArgs::class.java)
|
val args = invoke.parseArgs(KirimArgs::class.java)
|
||||||
val id = args.id
|
idKlien = args.idKlien
|
||||||
if (id.isNullOrEmpty()) {
|
if (idKlien.isNullOrEmpty()) {
|
||||||
invoke.reject("ID Klien belum disediakan")
|
invoke.reject("ID Klien belum disediakan")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val googleIdOption: GetGoogleIdOption = GetGoogleIdOption.Builder()
|
val googleIdOption: GetGoogleIdOption = GetGoogleIdOption.Builder()
|
||||||
.setFilterByAuthorizedAccounts(true)
|
.setFilterByAuthorizedAccounts(true)
|
||||||
.setServerClientId(id)
|
.setServerClientId(idKlien)
|
||||||
.setNonce(generateSecureRandomNonce())
|
.setNonce(generateSecureRandomNonce())
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
@@ -63,7 +64,11 @@ class AuthPlugin(private val activity: Activity) : Plugin(activity) {
|
|||||||
)
|
)
|
||||||
handleSignInResult(result, invoke)
|
handleSignInResult(result, invoke)
|
||||||
} catch (e: NoCredentialException) {
|
} catch (e: NoCredentialException) {
|
||||||
signInWithAllAccounts(id, invoke)
|
if (args.filterByAuthorizedAccounts) {
|
||||||
|
signInWithAllAccounts(idKlien, invoke)
|
||||||
|
} else {
|
||||||
|
invoke.reject("Tidak ada kredensial Google yang tersedia: ${e.message}")
|
||||||
|
}
|
||||||
} catch (e: GetCredentialException) {
|
} catch (e: GetCredentialException) {
|
||||||
invoke.reject("Gagal masuk: ${e.message}")
|
invoke.reject("Gagal masuk: ${e.message}")
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ export type SAuthMuatanMasuk = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export async function masuk(muatan: SAuthMuatanMasuk): Promise<null> {
|
export async function masuk(muatan: SAuthMuatanMasuk): Promise<null> {
|
||||||
return await invoke<null>("plugin:auth|masuk", { muatan: muatan });
|
return await invoke<null>("plugin:auth|masuk", { payload: muatan });
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function keluar(): Promise<null> {
|
export async function keluar(): Promise<null> {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@segubi/tauri-plugin-auth-api",
|
"name": "@segubi/tauri-plugin-auth-api",
|
||||||
"version": "0.1.8",
|
"version": "0.1.0",
|
||||||
"author": "Rizky Denianto",
|
"author": "Rizky Denianto",
|
||||||
"description": "Program sederhana untuk interaksi dengan autentikasi aplikasi tauri di berbagai sistem operasi",
|
"description": "Program sederhana untuk interaksi dengan autentikasi aplikasi tauri di berbagai sistem operasi",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
+2
-2
@@ -5,8 +5,8 @@ use crate::Result;
|
|||||||
use crate::models::SAuthMuatanMasuk;
|
use crate::models::SAuthMuatanMasuk;
|
||||||
|
|
||||||
#[command]
|
#[command]
|
||||||
pub(crate) async fn masuk<R: Runtime>(app: AppHandle<R>, muatan: SAuthMuatanMasuk) -> Result<()> {
|
pub(crate) async fn masuk<R: Runtime>(app: AppHandle<R>, payload: SAuthMuatanMasuk) -> Result<()> {
|
||||||
return app.auth().masuk(muatan);
|
return app.auth().masuk(payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[command]
|
#[command]
|
||||||
|
|||||||
+3
-3
@@ -25,14 +25,14 @@ pub fn init<R: Runtime, C: DeserializeOwned>(
|
|||||||
pub struct Auth<R: Runtime>(PluginHandle<R>);
|
pub struct Auth<R: Runtime>(PluginHandle<R>);
|
||||||
|
|
||||||
impl<R: Runtime> Auth<R> {
|
impl<R: Runtime> Auth<R> {
|
||||||
pub fn masuk(&self, muatan: SAuthMuatanMasuk) -> crate::Result<()> {
|
pub fn masuk(&self, payload: SAuthMuatanMasuk) -> crate::Result<()> {
|
||||||
return self
|
return self
|
||||||
.0
|
.0
|
||||||
.run_mobile_plugin("masuk", muatan)
|
.run_mobile_plugin("masuk", payload)
|
||||||
.map_err(Into::into);
|
.map_err(Into::into);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn keluar(&self) -> crate::Result<()> {
|
pub fn keluar(&self) -> crate::Result<Vec<()>> {
|
||||||
return self.0.run_mobile_plugin("keluar", ()).map_err(Into::into);
|
return self.0.run_mobile_plugin("keluar", ()).map_err(Into::into);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -3,5 +3,5 @@ use serde::{Deserialize, Serialize};
|
|||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct SAuthMuatanMasuk {
|
pub struct SAuthMuatanMasuk {
|
||||||
pub id: String,
|
pub id_klien: String,
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user