Skip to content

Commit b3da7a6

Browse files
committed
Improve SSO demo UX
- Update docker compose command to use `--watch` flag - Add watch configuration for SQLPage development - Enhance login page with hero component and better styling - Simplify protected page welcome message - Fix OIDC middleware path check logic - Update protected paths in config to use `/protected` instead of `/protected.sql`
1 parent 741f2e1 commit b3da7a6

File tree

5 files changed

+22
-15
lines changed

5 files changed

+22
-15
lines changed

examples/single sign on/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Depending on your use case, you can choose the appropriate protocol for your app
2020
To run the demo, you just need docker and docker-compose installed on your machine. Then, run the following commands:
2121

2222
```bash
23-
docker-compose up
23+
docker compose up --watch
2424
```
2525

2626
This will start a Keycloak server and a SQLPage server. You can access the SQLPage application at http://localhost:8080.
@@ -115,4 +115,3 @@ The demo uses Docker Compose to set up both SQLPage and Keycloak. The configurat
115115
- [SQLPage OIDC Documentation](https://sql-page.com/sso)
116116
- [OpenID Connect](https://openid.net/connect/)
117117
- [Authorization Code Flow](https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth)
118-

examples/single sign on/docker-compose.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ services:
2525
depends_on:
2626
keycloak:
2727
condition: service_healthy
28+
develop:
29+
watch:
30+
- action: restart
31+
path: ./sqlpage/
2832

2933
keycloak:
3034
build:

examples/single sign on/index.sql

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
SELECT 'shell' as component, 'My public app' as title;
22

3-
-- For anonymous users
4-
SELECT 'text' as component,
5-
'You are not logged in.' as title,
6-
'This is a public page. Click the button below to log in and access the protected page.' as contents_md
7-
WHERE sqlpage.user_info('email') IS NULL;
3+
set email = sqlpage.user_info('email');
84

9-
SELECT 'button' as component WHERE sqlpage.user_info('email') IS NULL;
10-
SELECT 'Login' as title, 'protected.sql' as link, 'login' as icon WHERE sqlpage.user_info('email') IS NULL;
5+
-- For anonymous users
6+
SELECT 'hero' as component,
7+
'/protected' as link,
8+
'Log in' as link_text,
9+
'Welcome' as title,
10+
'You are currently browsing as a guest. Log in to access the protected page.' as description,
11+
'https://images.pexels.com/photos/954599/pexels-photo-954599.jpeg' as image
12+
WHERE $email IS NULL;
1113

1214
-- For logged-in users
1315
SELECT 'text' as component,
1416
'Welcome back, ' || sqlpage.user_info('name') || '!' as title,
15-
'You are logged in as ' || sqlpage.user_info('email') || '. You can now access the [protected page](protected.sql) or [log out](logout.sql).' as contents_md
16-
WHERE sqlpage.user_info('email') IS NOT NULL;
17+
'You are logged in as ' || sqlpage.user_info('email') || '. You can now access the [protected page](/protected) or [log out](/logout).' as contents_md
18+
WHERE $email IS NOT NULL;

examples/single sign on/protected.sql

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ select 'shell' as component, 'My secure app' as title,
44
'logout' as menu_item;
55

66
select 'text' as component,
7-
'You're in !' as title,
8-
'You are logged in as *`' || $user_email || '`*.\nYou have access to this protected page.
7+
'You''re in, '|| sqlpage.user_info('name') || ' !' as title,
8+
'You are logged in as *`' || $user_email || '`*.
9+
10+
You have access to this protected page.
911
1012
![open door](/assets/welcome.jpeg)'
1113
as contents_md;
1214

1315
select 'list' as component;
1416
select key as title, value as description
15-
from json_each(sqlpage.user_info_token());
17+
from json_each(sqlpage.user_info_token());

examples/single sign on/sqlpage/sqlpage.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ oidc_issuer_url: http://localhost:8181/realms/sqlpage_demo
22
oidc_client_id: sqlpage
33
oidc_client_secret: qiawfnYrYzsmoaOZT28rRjPPRamfvrYr # For a safer setup, use environment variables to store this
44
oidc_protected_paths:
5-
- /protected.sql
5+
- /protected

0 commit comments

Comments
 (0)