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.
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.

docs/nuxt.config.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,9 @@ export default defineNuxtConfig({
6464
clientBundle: {
6565
scan: true,
6666
},
67-
serverBundle: false,
68-
/* {
69-
collections: ['simple-icons', 'carbon'],
70-
}, */
67+
serverBundle: {
68+
collections: ['simple-icons', 'carbon', 'heroicons'],
69+
},
7170
},
7271

7372
site: {

docs/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"dev": "nuxi dev",
1010
"generate": "nuxi generate",
1111
"build": "set NODE_OPTIONS=--disable-warning=DEP0155 --disable-warning=DEP0166 && nuxi build",
12-
"preview": "nuxi preview"
12+
"preview": "nuxi preview",
13+
"swadeploy": "dotenv -- swa deploy .output/public --api-location .output/server --api-language \"node\" --api-version \"20\" --env production"
1314
},
1415
"dependencies": {
1516
"@iconify-json/carbon": "^1.2.1",
@@ -27,7 +28,9 @@
2728
},
2829
"devDependencies": {
2930
"@antfu/eslint-config": "^3.7.3",
31+
"@azure/static-web-apps-cli": "^2.0.1",
3032
"@nuxt/eslint": "^0.5.7",
33+
"dotenv-cli": "^7.4.2",
3134
"eslint": "^9.11.1",
3235
"typescript": "^5.6.2",
3336
"vue-tsc": "^2.1.6"
13.6 KB
Loading

docs/staticwebapp.config.json

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
11
{
22
"routes": [
3-
{
4-
"route": "/provider/paypal",
5-
"rewrite": "/provider/paypal/index.html"
6-
},
73
{
84
"route": "/getting-started/installation",
95
"rewrite": "/getting-started/installation/index.html"
106
},
11-
{
12-
"route": "/provider/auth0",
13-
"rewrite": "/provider/auth0/index.html"
14-
},
15-
{
16-
"route": "/provider/keycloak",
17-
"rewrite": "/provider/keycloak/index.html"
18-
},
197
{
208
"route": "/provider/zitadel",
219
"rewrite": "/provider/zitadel/index.html"
@@ -25,24 +13,36 @@
2513
"rewrite": "/provider/entra/index.html"
2614
},
2715
{
28-
"route": "/provider/github",
29-
"rewrite": "/provider/github/index.html"
16+
"route": "/provider/aws-cognito",
17+
"rewrite": "/provider/aws-cognito/index.html"
3018
},
3119
{
3220
"route": "/provider/oidc",
3321
"rewrite": "/provider/oidc/index.html"
3422
},
3523
{
36-
"route": "/provider/aws-cognito",
37-
"rewrite": "/provider/aws-cognito/index.html"
24+
"route": "/provider/microsoft",
25+
"rewrite": "/provider/microsoft/index.html"
3826
},
3927
{
40-
"route": "/hooks",
41-
"rewrite": "/hooks/index.html"
28+
"route": "/provider/github",
29+
"rewrite": "/provider/github/index.html"
4230
},
4331
{
44-
"route": "/server-utils/middleware",
45-
"rewrite": "/server-utils/middleware/index.html"
32+
"route": "/provider/paypal",
33+
"rewrite": "/provider/paypal/index.html"
34+
},
35+
{
36+
"route": "/provider/keycloak",
37+
"rewrite": "/provider/keycloak/index.html"
38+
},
39+
{
40+
"route": "/provider/auth0",
41+
"rewrite": "/provider/auth0/index.html"
42+
},
43+
{
44+
"route": "/hooks",
45+
"rewrite": "/hooks/index.html"
4646
},
4747
{
4848
"route": "/server-utils/oidc-handlers",
@@ -52,6 +52,10 @@
5252
"route": "/server-utils/session-management",
5353
"rewrite": "/server-utils/session-management/index.html"
5454
},
55+
{
56+
"route": "/server-utils/middleware",
57+
"rewrite": "/server-utils/middleware/index.html"
58+
},
5559
{
5660
"route": "/configuration",
5761
"rewrite": "/configuration/index.html"

docs/tailwind.config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Config } from 'tailwindcss'
22
import defaultTheme from 'tailwindcss/defaultTheme'
3+
import plugin from 'tailwindcss/plugin'
34

45
export default <Partial<Config>>{
56
theme: {
@@ -27,4 +28,15 @@ export default <Partial<Config>>{
2728
},
2829
},
2930
},
31+
plugins: [
32+
plugin(({ addVariant, addUtilities }) => {
33+
addVariant('popover-open', '&:popover-open')
34+
addVariant('starting', '@starting-style')
35+
addUtilities({
36+
'.transition-discrete': {
37+
transitionBehavior: 'allow-discrete',
38+
},
39+
})
40+
}),
41+
],
3042
}

0 commit comments

Comments
 (0)