-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Fake IdP SAML App tokens: Frontend (#623)
* Add Idp App tokens to frontend * Idp token Preview component (#603) * Add animation to Download button --------- Co-authored-by: vittoriaThinkst <[email protected]> Co-authored-by: Vittoria Toso <[email protected]>
- Loading branch information
1 parent
8dee4db
commit 29817b0
Showing
49 changed files
with
496 additions
and
15 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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
108 changes: 108 additions & 0 deletions
108
frontend_vue/src/components/base/BaseDownloadIconButton.vue
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,108 @@ | ||
<template> | ||
<div | ||
:class="props.disabled ? 'hover:brightness-100' : 'hover:brightness-110'" | ||
class="relative flex items-center justify-center p-8 duration-100 bg-white border cursor-pointer rounded-2xl border-grey-200" | ||
> | ||
<a | ||
v-bind="$attrs" | ||
class="bg-cover min-w-[2.5rem] min-h-[2.2rem] duration-100 aspect-square" | ||
:class="{ 'bg-grey-200 cursor-default': props.disabled }" | ||
:style=" | ||
!props.disabled && props.url | ||
? { backgroundImage: `url(${props.url})` } | ||
: '' | ||
" | ||
:disabled="props.disabled" | ||
download | ||
:href="props.url" | ||
@click="downloadContent" | ||
> | ||
<span class="sr-only">{{ props.alt }} Download</span> | ||
|
||
<span | ||
v-tooltip="{ | ||
content: tooltipText, | ||
shown: isTriggered, | ||
triggers: tooltipTriggers, | ||
}" | ||
:class="{ hidden: props.disabled }" | ||
class="absolute w-[1.5rem] rounded-full h-[1.5rem] bg-green top-[-.5rem] right-[-.5rem] flex items-center justify-center text-white" | ||
> | ||
<Transition | ||
name="fade" | ||
mode="out-in" | ||
> | ||
<font-awesome-icon | ||
v-if="!isTriggered" | ||
icon="arrow-down" | ||
></font-awesome-icon> | ||
<font-awesome-icon | ||
v-else | ||
aria-hidden="true" | ||
icon="check" | ||
></font-awesome-icon> | ||
</Transition> | ||
</span> | ||
</a> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { ref } from 'vue'; | ||
const props = defineProps<{ | ||
url?: string; | ||
alt?: string; | ||
disabled?: boolean; | ||
}>(); | ||
const tooltipText = ref('Download'); | ||
const isTriggered = ref(false); | ||
const tooltipTriggers = ref(['hover', 'focus']); | ||
function delay(ms: number) { | ||
return new Promise((resolve) => setTimeout(resolve, ms)); | ||
} | ||
// 1. prevents UI from jumping when tooltip content changes | ||
// 2. shows tooltip when content is downloaded | ||
async function showTooltip() { | ||
await delay(150); | ||
tooltipTriggers.value = []; | ||
isTriggered.value = true; | ||
tooltipText.value = 'Download started!'; | ||
// vTooltip sets a default delay of 1.5s | ||
await delay(1500); | ||
isTriggered.value = false; | ||
tooltipTriggers.value = ['hover', 'focus']; | ||
await delay(150); | ||
tooltipText.value = 'Download'; | ||
} | ||
function downloadContent() { | ||
showTooltip(); | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
@keyframes bounce { | ||
40% { | ||
transform: scale(1.2); | ||
} | ||
80% { | ||
transform: scale(0.8); | ||
} | ||
100% { | ||
transform: scale(1); | ||
} | ||
} | ||
.fade-enter-active, | ||
.fade-leave-active { | ||
animation: bounce 350ms; | ||
} | ||
.fade-enter, | ||
.fade-leave-to { | ||
transform: scale(1); | ||
} | ||
</style> |
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
28 changes: 28 additions & 0 deletions
28
frontend_vue/src/components/tokens/idp_app/ActivatedToken.vue
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,28 @@ | ||
<template> | ||
<TokenDisplay | ||
:token-url="tokenUrl" | ||
:entity-id="entityId" | ||
:app-type="appType" | ||
/> | ||
<p class="mt-16 text-sm"> | ||
When the fake app is opened from your IdP dashboard you receive an alert. | ||
<ButtonActivateTokenTips @how-to-use="$emit('howToUse')" /> | ||
</p> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref } from 'vue'; | ||
import TokenDisplay from './TokenDisplay.vue'; | ||
import type { NewTokenBackendType } from '@/components/tokens/types'; | ||
import ButtonActivateTokenTips from '@/components/ui/ButtonActivateTokenTips.vue'; | ||
const props = defineProps<{ | ||
tokenData: NewTokenBackendType; | ||
}>(); | ||
defineEmits(['howToUse']); | ||
const tokenUrl = ref(props.tokenData.token_url || ''); | ||
const entityId = ref(props.tokenData.entity_id || ''); | ||
const appType = ref(props.tokenData.app_type || ''); | ||
</script> |
70 changes: 70 additions & 0 deletions
70
frontend_vue/src/components/tokens/idp_app/GenerateTokenForm.vue
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,70 @@ | ||
<template> | ||
<BaseGenerateTokenSettings setting-type="Canarytoken"> | ||
<div class="flex flex-col gap-8"> | ||
<BaseFormSelect | ||
id="app_type" | ||
label="The App I want my Canarytoken to look like" | ||
placeholder="Select an app" | ||
required | ||
:options="IDP_OPTIONS" | ||
:searchable="true" | ||
height="220px" | ||
@select-option="handleSelectedApp" | ||
> | ||
<template #option="{ option }"> | ||
<div class="flex flex-row items-center gap-16"> | ||
<div | ||
alt="icon" | ||
:style="{ | ||
backgroundImage: `url(${getImageUrl('idp_icons/' + option.value + '.png')})`, | ||
}" | ||
class="bg-cover w-[2rem] h-[2rem] duration-100" | ||
></div> | ||
{{ option.label }} | ||
</div> | ||
</template> | ||
|
||
<template #selected-option="{ option }"> | ||
<div class="flex flex-row items-center gap-8"> | ||
<div | ||
alt="icon" | ||
:style="{ | ||
backgroundImage: `url(${getImageUrl('idp_icons/' + option.value + '.png')})`, | ||
}" | ||
class="bg-cover w-[1.5rem] h-[1.5rem] duration-100" | ||
></div> | ||
{{ option.label }} | ||
</div> | ||
</template> | ||
</BaseFormSelect> | ||
<BaseFormTextField | ||
id="redirect_url" | ||
type="text" | ||
label="Send the user to this URL on login (Optional)" | ||
placeholder="https://www.example.com" | ||
full-width | ||
/> | ||
</div> | ||
</BaseGenerateTokenSettings> | ||
<GenerateTokenSettingsNotifications | ||
memo-helper-example="Fake Salesforce app in Okta" | ||
/> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import GenerateTokenSettingsNotifications from '@/components/ui/GenerateTokenSettingsNotifications.vue'; | ||
import getImageUrl from '@/utils/getImageUrl'; | ||
import { IDP_OPTIONS } from '@/components/constants'; | ||
import { ref } from 'vue'; | ||
type SelectedAppType = { | ||
value: string; | ||
label: string; | ||
}; | ||
const selectedApp = ref<SelectedAppType>(); | ||
function handleSelectedApp(selected: string) { | ||
selectedApp.value = IDP_OPTIONS.find((o) => o.value === selected); | ||
} | ||
</script> |
Oops, something went wrong.