Initial commit: OAuth IAM Laravel application
Laravel-based OAuth/IAM service with Passport, Vue 3 frontend, and Docker Compose setup for local and production deployment. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
67
resources/js/pages/AuthorizedApps.vue
Normal file
67
resources/js/pages/AuthorizedApps.vue
Normal file
@@ -0,0 +1,67 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue';
|
||||
import axios from 'axios';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import type { AuthorizedAppToken } from '../types/models';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const tokens = ref<AuthorizedAppToken[]>([]);
|
||||
const loading = ref(true);
|
||||
|
||||
async function load(): Promise<void> {
|
||||
loading.value = true;
|
||||
const { data } = await axios.get<AuthorizedAppToken[]>('/web-api/authorized-apps');
|
||||
tokens.value = data;
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
async function revoke(token: AuthorizedAppToken): Promise<void> {
|
||||
if (!confirm(t('authorizedApps.revokeConfirm', { name: token.client.name }))) return;
|
||||
|
||||
await axios.delete(`/web-api/authorized-apps/${token.id}`);
|
||||
await load();
|
||||
}
|
||||
|
||||
onMounted(load);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<h1 class="page-title">{{ t('authorizedApps.title') }}</h1>
|
||||
<p class="page-subtitle">{{ t('authorizedApps.subtitle') }}</p>
|
||||
|
||||
<div class="authorized-apps__list">
|
||||
<p v-if="loading" class="page-subtitle">{{ t('common.loading') }}</p>
|
||||
<p v-else-if="!tokens.length" class="page-subtitle">{{ t('authorizedApps.empty') }}</p>
|
||||
|
||||
<div v-for="token in tokens" :key="token.id" class="card authorized-apps__item">
|
||||
<div>
|
||||
<p class="card__title">{{ token.client.name }}</p>
|
||||
<p class="authorized-apps__item-meta">{{ t('authorizedApps.scopesLabel') }}: {{ token.scopes?.join(', ') || t('common.none') }}</p>
|
||||
</div>
|
||||
<button @click="revoke(token)" class="link link--danger">{{ t('authorizedApps.revoke') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.authorized-apps__list {
|
||||
margin-top: 1.5rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.authorized-apps__item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.authorized-apps__item-meta {
|
||||
font-size: 0.75rem;
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user