Skip to content

Commit b3c4087

Browse files
committed
docs(docs): 📝 Updated KeyCloak docs
1 parent c6c9e06 commit b3c4087

17 files changed

+1898
-208
lines changed
Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<script setup lang="ts">
22
interface Props {
33
src: string
4-
preset?: string | null
54
fit?: 'cover' | 'contain' | 'fill' | 'inside' | 'outside'
65
alt?: string
76
title?: string
@@ -11,17 +10,56 @@ withDefaults(defineProps<Props>(), {
1110
fit: 'cover',
1211
alt: '',
1312
})
13+
14+
const popoverId = useId()
15+
const contentId = useId()
16+
const imagePopover = ref<HTMLDialogElement | null>(null)
17+
const imagecontent = ref<HTMLDialogElement | null>(null)
18+
19+
onMounted(() => {
20+
imagePopover.value = document.getElementById(popoverId) as HTMLDialogElement
21+
imagecontent.value = document.getElementById(contentId) as HTMLDialogElement
22+
onClickOutside(imagecontent, _event => closeModal())
23+
})
24+
25+
function closeModal() {
26+
imagePopover.value?.hidePopover()
27+
}
1428
</script>
1529

1630
<template>
17-
<img
18-
:alt="alt"
19-
:src="src"
20-
:preset="preset || null"
21-
fit="fill"
22-
class="mb-2 rounded-lg transition-[filter] dark:brightness-75 dark:hover:brightness-100 shadow-lg mx-auto max-h-[500px]"
23-
>
24-
<p v-if="alt || title" class="text-center mt-0 opacity-70">
25-
{{ title || alt }}
26-
</p>
31+
<div class="flex justify-center">
32+
<button :popovertarget="popoverId">
33+
<NuxtImg
34+
:alt="alt"
35+
:src="src"
36+
fit="fill"
37+
sizes="100vw sm:50vw md:400px"
38+
class="mb-2 rounded-lg transition-[filter] dark:brightness-75 dark:hover:brightness-100 shadow-lg max-h-[500px]"
39+
/>
40+
<p v-if="alt || title" class="text-center mt-0 opacity-70">
41+
{{ title || alt }}
42+
</p>
43+
</button>
44+
<div :id="popoverId" popover="auto" class="transition-opacity ease-out transition-discrete h-full w-full bg-transparent p-0 justify-center place-items-center opacity-0 popover-open:grid popover-open:opacity-100 backdrop-blur-lg starting:popover-open:opacity-0">
45+
<div :id="contentId" class="max-w-[80%]">
46+
<div class="flex justify-between h-10 px-3 py-2 items-center mx-auto">
47+
<span class="text-xl font-bold">{{ title || alt }}</span>
48+
<button
49+
popovertarget="unocss-popover"
50+
class="size-6"
51+
@click="closeModal"
52+
>
53+
<UIcon name="i-carbon-close-outline" size="1.5rem" />
54+
<span class="sr-only">Close</span>
55+
</button>
56+
</div>
57+
<img
58+
:alt="alt"
59+
:src="src"
60+
class="mt-2 rounded-lg shadow-lg max-h-screen"
61+
>
62+
</div>
63+
</div>
64+
</div>
2765
</template>

docs/content/2.provider/1.index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Nuxt OIDC Auth includes presets for the following providers with tested default
1111
- [AWS Cognito](/provider/aws-cognito)
1212
- [Entra ID/Microsoft](/provider/entra)
1313
- [GitHub](/provider/github)
14-
- [Keycloak](/provider/keycloak)
14+
- [KeyCloak](/provider/keycloak)
1515
- [PayPal](/provider/paypal)
1616
- [Zitadel](/provider/zitadel)
1717
- [Generic OIDC](/provider/oidc)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Keycloak
3-
description: Keycloak provider documentation
2+
title: KeyCloak
3+
description: KeyCloak provider documentation
44
icon: i-simple-icons-keycloak
55
---
66

@@ -14,29 +14,32 @@ icon: i-simple-icons-keycloak
1414

1515
## Introduction
1616

17-
## Provider specific parameters
17+
KeyCloak is an open-source identity and access management solution that provides features like single sign-on (SSO), social login, and user management, making it a popular choice for securing applications. This provider has tested defaults for KeyCloak to offer seamless OpenID Connect (OIDC) authentication with minimal necessary configuration.
1818

19-
Additional parameters to be used in additionalAuthParameters,
20-
additionalTokenParameters or additionalLogoutParameters:
19+
## Example Configurations
2120

22-
| Option | Type | Default | Description |
23-
|---|---|---|---|
24-
| realm | `string` | - | Optional. This parameter allows to slightly customize the login flow on the Keycloak server side. For example, enforce displaying the login screen in case of value login. |
25-
| realm | `string` | - | Optional. Used to pre-fill the username/email field on the login form. |
26-
| realm | `string` | - | Optional. Used to tell Keycloak to skip showing the login page and automatically redirect to the specified identity provider instead. |
27-
| realm | `string` | - | Optional. Sets the 'ui_locales' query param. |
21+
::callout{icon="i-carbon-warning-alt" color="amber"}
22+
Never store sensitive values like your client secret in your Nuxt config. Our recommendation is to inject at least client id and client secret via. environment variables.
23+
::
2824

29-
For more information on these parameters, check the [KeyCloak documentation](https://www.keycloak.org/docs/latest/securing_apps/#methods).
25+
### Minimal
3026

31-
For Keycloak you have to provide at least the `baseUrl`, `clientId` and `clientSecret` properties. The `baseUrl` is used to dynamically create the `authorizationUrl`, `tokenUrl`, `logoutUrl` and `userInfoUrl`.
32-
Please include the realm you want to use in the `baseUrl` (e.g. `https://<keycloak-url>/realms/<realm>`).
33-
If you don't want to use the post logout redirect feature of key cloak, set `logoutUrl` to `undefined` or `''`.
34-
Also remember to enable `Client authentication` to be able to get a client secret.
27+
```typescript [nuxt.config.ts]
28+
keycloak: {
29+
audience: 'account',
30+
baseUrl: '',
31+
clientId: '',
32+
clientSecret: '',
33+
redirectUri: 'http://localhost:3000/auth/keycloak/callback',
34+
},
35+
```
3536

36-
## Example Configuration
37+
### Use logout url
3738

38-
::callout{icon="i-carbon-warning-alt" color="amber"}
39-
Never store sensitive values like your client secret in your Nuxt config. Our recommendation is to inject at least client id and client secret via. environment variables.
39+
The to redirect to a specific url after logout, use the `logoutRedirectUri` configuration.
40+
You have to specifically allow a redirect uri, if you want your application to redirect to there after logout:
41+
42+
::contentImage{src="/content/keycloak-logoutredirect.png" alt="KeyCloak logout redirect"}
4043
::
4144

4245
```typescript [nuxt.config.ts]
@@ -47,9 +50,15 @@ keycloak: {
4750
clientSecret: '',
4851
redirectUri: 'http://localhost:3000/auth/keycloak/callback',
4952
userNameClaim: 'preferred_username',
53+
logoutRedirectUri: 'http://localhost:3000', // Target of your post logout redirection
5054
},
5155
```
5256

57+
By default, the following settings are already set internall, but can be overwritten, if needed
58+
59+
- `logoutUrl`: `protocol/openid-connect/logout`,
60+
- `logoutRedirectParameterName`: `post_logout_redirect_uri`,
61+
5362
### Environment variables
5463

5564
Dotenv files are only for (local) development. Use a proper configuration management or injection system in production.
@@ -59,3 +68,21 @@ NUXT_OIDC_PROVIDERS_KEYCLOAK_CLIENT_SECRET=CLIENT_SECRET
5968
NUXT_OIDC_PROVIDERS_KEYCLOAK_CLIENT_ID=CLIENT_ID
6069
NUXT_OIDC_PROVIDERS_KEYCLOAK_BASE_URL=http://localhost:8080/realms/nuxt-oidc-test
6170
```
71+
72+
## Provider specific parameters
73+
74+
Additional parameters to be used in additionalAuthParameters, additionalTokenParameters or additionalLogoutParameters:
75+
76+
| Option | Type | Default | Description |
77+
|---|---|---|---|
78+
| realm | `string` | - | Optional. This parameter allows to slightly customize the login flow on the KeyCloak server side. For example, enforce displaying the login screen in case of value login. |
79+
| realm | `string` | - | Optional. Used to pre-fill the username/email field on the login form. |
80+
| realm | `string` | - | Optional. Used to tell KeyCloak to skip showing the login page and automatically redirect to the specified identity provider instead. |
81+
| realm | `string` | - | Optional. Sets the 'ui_locales' query param. |
82+
83+
For more information on these parameters, check the [KeyCloak documentation](https://www.keycloak.org/docs/latest/securing_apps/#methods).
84+
85+
For KeyCloak you have to provide at least the `baseUrl`, `clientId` and `clientSecret` properties. The `baseUrl` is used to dynamically create the `authorizationUrl`, `tokenUrl`, `logoutUrl` and `userInfoUrl`.
86+
Please include the realm you want to use in the `baseUrl` (e.g. `https://<keycloak-url>/realms/<realm>`).
87+
If you don't want to use the post logout redirect feature of key cloak, set `logoutUrl` to `undefined` or `''`.
88+
Also remember to enable `Client authentication` to be able to get a client secret.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)