Skip to content

Commit 209a01f

Browse files
committed
fix(oauth2): show warning if redirect URI will be invalid in Entra
CMK-29086 Change-Id: I6d2ed2ccc608a0d0d3b9e1dc168bdb8eb5e56436
1 parent 06d0331 commit 209a01f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

packages/cmk-frontend-vue/src/mode-oauth2-connection/steps/RedirectURI.vue

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ conditions defined in the file COPYING, which is part of this source code packag
66

77
<script setup lang="ts">
88
import { type Oauth2Urls } from 'cmk-shared-typing/typescript/mode_oauth2_connection'
9+
import { computed } from 'vue'
910
1011
import usei18n from '@/lib/i18n'
1112
13+
import CmkAlertBox from '@/components/CmkAlertBox.vue'
1214
import CmkCode from '@/components/CmkCode.vue'
1315
import type { CmkWizardStepProps } from '@/components/CmkWizard'
1416
import { CmkWizardButton, CmkWizardStep } from '@/components/CmkWizard'
@@ -23,6 +25,15 @@ const props = defineProps<
2325
urls: Oauth2Urls
2426
}
2527
>()
28+
29+
const redirectUri = computed(() => buildRedirectUri(props.urls.redirect))
30+
const redirectUriValid = computed(() => {
31+
const url = new URL(redirectUri.value)
32+
if (url.protocol === 'https:') {
33+
return true
34+
}
35+
return url.protocol === 'http:' && url.hostname === 'localhost'
36+
})
2637
</script>
2738

2839
<template>
@@ -37,6 +48,13 @@ const props = defineProps<
3748
'Open the Redirect URIs or navigate to the Authentication settings and register the following Web redirect URI'
3849
)
3950
}}
51+
<CmkAlertBox v-if="!redirectUriValid" variant="warning">
52+
{{
53+
_t(
54+
'Only valid redirect URIs starting with https:// or http://localhost can be used. Please check if either of these two options can be applied.'
55+
)
56+
}}
57+
</CmkAlertBox>
4058
<CmkCode :code_txt="buildRedirectUri(props.urls.redirect)" />
4159
</template>
4260

0 commit comments

Comments
 (0)