739 Commits

Author SHA1 Message Date
lovasoa 627b4789cb improve sso example (logout + auth custom) 2025-07-30 17:26:11 +02:00
Ophir LOJKINE 2a13f62738 Support multiple jwt audiences for oidc (#977)
* Add OIDC multiple audiences support with configurable trust settings

Co-authored-by: contact <contact@ophir.dev>

* Refactor OIDC audience verification with improved configuration options

Co-authored-by: contact <contact@ophir.dev>

* remive verbose docs

* Refactor OIDC audience verification logic

The changes move audience verification into a dedicated type and improve
code organization around ID token verification.

* Use oidc_additional_trusted_audiences in sso example

Add OIDC config comments and improve array syntax

* document oidc_additional_trusted_audiences

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-07-30 17:10:37 +02:00
lovasoa 4b15bf19b5 Update Keycloak configuration display names to SQLPage SSO Demo 2025-07-29 17:39:53 +02:00
lovasoa 630a9eaef6 fix sso example logout link 2025-07-29 13:35:20 +02:00
lovasoa 7b7e4ccdc0 Escape search input in SQLite FTS queries
The search term is now properly escaped when used in SQLite full-text
search queries to prevent syntax errors with quotes. This ensures
searches containing quotes work correctly.
2025-07-28 18:08:29 +02:00
Ophir LOJKINE 33125565d3 Check for 404 before redirecting on no-extension paths (#972)
* Check for 404 before redirecting on no-extension paths

The commit improves routing logic by checking if a path would result in
a 404

fixes https://github.com/sqlpage/SQLPage/issues/971 before adding a
trailing slash. This prevents unnecessary redirects when a custom 404
handler exists.

* Fix test function signature formatting in routing module (#973)

Co-authored-by: Cursor Agent <cursoragent@cursor.com>

* Simplify path resolution and redirect logic

The shorter code more clearly handles finding files with .sql extensions
and decides whether to add trailing slashes based on index file
presence.

* clippy

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-07-28 17:54:23 +02:00
lovasoa ae30d82917 biome fixes 2025-07-27 00:09:39 +02:00
lovasoa 0d7d58c103 update biome 2025-07-26 23:37:32 +02:00
lovasoa 630882ef5c remove large file 2025-07-25 21:30:15 +02:00
Lenardt Gerhardts 84db9b2276 Added configuration option to skip OIDC authorization checks for certain endpoints (#969)
* Added posibility to bypass oidc authentication for certain endpoints

* fixxed missing .clone()

* Fixxed oidc_skip_endpoints not being optional

* feat(oidc): Introduce protected path prefixes

This commit replaces the OIDC endpoint blacklist with a path prefix whitelist. This is a more intuitive and secure approach for managing protected routes.

The new `oidc_protected_paths` configuration option allows users to specify a list of URL prefixes that require OIDC authentication. By default, all paths are protected.

The documentation has been updated to reflect this change, with clear examples and more user-friendly language.

* docs(oidc): Improve OIDC documentation and examples

This commit improves the OIDC documentation and the "single sign on"
example to better demonstrate how to create a selective login system.

The main documentation now includes a section on creating a public
login page and the "single sign on" example has been updated to
reflect this pattern.

* Simplify OIDC middleware request handling for unprotected paths

* docs(oidc): Improve single sign on example

This commit improves the "single sign on" example to better
demonstrate a public information page that adapts to the users
login status and a separate protected page.

* docs(oidc): Document oidc_protected_paths in configuration.md

This commit updates the main configuration documentation to reflect the
new `oidc_protected_paths` option. It removes the outdated
`oidc_skip_endpoints` and provides a more detailed explanation of how
to create a mix of public and private pages.

* 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`

* Skip OIDC auth for non-protected paths later in middleware

We still want to be able to access authenticated user's info in
non-authenticated parts of the app.

We crucially need to check request.path() == SQLPAGE_REDIRECT_URI before
the protected_paths check

* Added whitelist option

* Update configuration.md

* Improve OIDC public paths documentation

The documentation now provides clearer examples and explains the
interaction between public and protected paths more precisely. Also
removes the now-unused default_oidc_public_paths function since the
field's default is handled by serde's default for Vec.

* Add OidcConfig method to check public paths

The new `is_public_path` method consolidates the logic for checking if a
path should bypass OIDC authentication. This replaces the previous
inline checks for public and protected paths.

* fix default empty public paths

* Update SSO example with new image path and public access rules

- Change hero image path in login page - Remove protected.sql as it's no
longer needed - Update sqlpage.yaml to allow public access to
/protected/public

---------

Co-authored-by: Lenardt Gerhardts <lenardt.gerhardts@obi.de>
Co-authored-by: lovasoa <contact@ophir.dev>
2025-07-25 21:15:53 +02:00
Ophir LOJKINE a351d6b8fc sso docs: do not mention github, since it is not an oidc provider
github does not implement oidc

see https://github.com/sqlpage/SQLPage/issues/963
2025-07-18 18:09:51 +02:00
lovasoa 21b4287753 test new modal component + changelog 2025-06-27 15:49:34 +02:00
olivierauverlot 3834f18e88 New modal component (#934)
* New modal component and upgrade of the button component to allow the opening of a modal box

* Modal component

* Update examples/official-site/sqlpage/migrations/63_modal.sql

* Support for embed content in modal box
2025-06-27 14:32:37 +02:00
Andrew Straw 7ccf735298 fix docs (#942)
The `:` character is a colon (not a semi-colon).
2025-06-22 17:43:23 +02:00
lovasoa fdee60146f format 2025-06-02 21:19:01 +02:00
lovasoa d0e493fb13 Rich text editor: readonly mode
https://github.com/sqlpage/SQLPage/discussions/913#discussioncomment-13343491
2025-06-02 20:57:19 +02:00
lovasoa 541053f4f7 fix docker image reference 2025-05-28 00:24:44 +02:00
lovasoa 5c38eb1bd7 chart component: fix zero values in stacked bar charts
fixes https://github.com/sqlpage/SQLPage/issues/924
2025-05-27 12:31:54 +02:00
lovasoa 61677ab5b7 landing page links 2025-05-26 01:30:48 +02:00
hanskihyv eaac4c75b6 Add link & target props to big_number.handlebars (#861)
* Add link & target props to big_number.handlebars

* Refactor: added new links in 49_big_number.sql and updated big_number.handlebars

* Refactor: added new links in 49_big_number.sql

* Apply suggestions from code review

* fix broken links in the documentation

* Update CHANGELOG.md

---------

Co-authored-by: Ophir LOJKINE <contact@ophir.dev>
2025-05-20 01:21:26 +02:00
olivierauverlot 29f64479b5 form improvements with new types of field: header and switch (#906)
* form improvements with new types of field: header and switch

* added checked toggle switch example

* add names to the switch checkboxes

* update form header margins

* trailing whitespace

* docs

---------

Co-authored-by: lovasoa <contact@ophir.dev>
2025-05-20 00:54:05 +02:00
lovasoa bbaf2097fa improve official site form field visual appearance 2025-05-20 00:34:13 +02:00
lovasoa 9939c7512c fmt 2025-05-09 02:04:04 +02:00
lovasoa a07ddc167c rich text editor: improve handling of attributes for paragraphs, headings, list items, blockquotes, and code blocks 2025-05-09 01:42:05 +02:00
lovasoa 3075e482b6 improve rich text edition
https://github.com/sqlpage/SQLPage/discussions/913#discussioncomment-13079456
2025-05-09 01:35:55 +02:00
lovasoa 15c7b07a73 lint 2025-05-08 23:51:37 +02:00
lovasoa 49ab2be35d add null handling for search input and clean up whitespace
fixes https://github.com/sqlpage/SQLPage/issues/884#issuecomment-2863873123
2025-05-08 23:14:11 +02:00
lovasoa c323bde4da fmt 2025-05-08 23:01:55 +02:00
lovasoa fb26609325 Refactor example cards: move example cards data to a new migration file and remove deprecated SQL from index.sql. Add rich text editor SVG asset. 2025-05-08 01:03:26 +02:00
lovasoa 3d9ab826df Enhance rich text editor: add required field validation for content and implement Markdown to Quill Delta conversion
fixes https://github.com/sqlpage/SQLPage/discussions/913
2025-05-08 01:02:56 +02:00
lovasoa 845e0371ec sql-page.com search: dynamic component retrieval and improve link data handling 2025-05-08 01:01:46 +02:00
lovasoa d526ccbc01 add full text search 2025-05-07 01:50:04 +02:00
Andrews Innovations 275b44ae51 Add active indicator to the shell nav items (#908)
* Added active indicator to the nav-item to highlight active navigation item

* Update documentation to reflect active property on a menu_item

* Updated shell component examples to separate active flag as its own example

* Update examples/official-site/sqlpage/migrations/01_documentation.sql

---------

Co-authored-by: Ophir LOJKINE <contact@ophir.dev>
2025-05-06 09:36:43 +02:00
Ophir LOJKINE adcbaa680b Single Sign-On via OpenID Connect (#888)
* add oidc config variables

* setup a basic middleware

* implement an async http client that uses oidc

* initialize provider_metadata in OidcService

* better error handling in oidc config

* HTTP client initialization in oidc now follows global config

* oidc: implement redirects

- Add `host` configuration option for specifying the application's web address in configuration.md and app_config.rs.
- Update docker-compose.yaml to include SQLPAGE_HOST and SQLPAGE_OIDC_ISSUER_URL environment variables.
- Enhance OIDC middleware to utilize the new `host` setting for redirect URLs and improve cookie handling in oidc.rs.

* improve local oidc configurability

* log

* Update warning message in OIDC configuration to clarify how to disable it by providing a host setting

* Update OIDC redirect logging to use info level with client ID

* Refactor unauthenticated request handling in OIDC service

- Extracted logic for handling unauthenticated requests into a separate method `handle_unauthenticated_request`.
- Updated the main request handling flow to utilize the new method for improved readability and maintainability.

* Enhance OIDC service with callback handling and token processing

- Introduced `handle_oidc_callback` method to manage OIDC callback requests.
- Added `process_oidc_callback` and `exchange_code_for_token` methods for token exchange logic.
- Updated `handle_unauthenticated_request` to check for callback URL and redirect accordingly.
- Refactored `build_redirect_response` to improve clarity in response handling.

* in handle_oidc_callback use service_request.into_response

* fmt

* Implement oidc code exchange and token storage

* validate oidc cookies

- Updated `get_sqlpage_auth_cookie` to return a result for better error handling and validation of the SQLPage auth cookie.
- Improved logging throughout the OIDC service for better traceability of requests and responses.
- Adjusted the handling of OIDC callback parameters to include context in error messages.

* OIDC callback: redirect to the auth URL on failure.

* oidc use localhost for redirect config instead of 0.0.0.0 by default

* Enhance OIDC provider metadata discovery with improved logging and error context

* maintain the initial URL during OIDC authentication

- Added state cookie handling to maintain the initial URL during OIDC authentication.
- Refactored `build_auth_url` to accept the initial URL as a parameter.
- Enhanced `process_oidc_callback` to retrieve the state from the cookie and redirect accordingly.

* implement csrf token

* update deps

* update sso examples

* nonce verification

- Improved error logging for invalid auth cookies and ID token verification.
- Introduced nonce verification logic to ensure security during OIDC authentication.
- Adjusted parameters for nonce hashing to optimize for short-lived tokens.

* Refactor OIDC logging and improve documentation

- Updated logging statements for better clarity and context.
- Refactored code for nonce verification and error handling.
- Enhanced documentation in `app_config.rs` for clarity on `https_domain` usage.

* Remove unused app_state field from OidcService struct

* Enhance OIDC client error handling and refactor HTTP request types

- Added context to OIDC client creation error handling.
- Updated HTTP request and response types for better integration with the openidconnect library.
- Introduced AwcWrapperError for improved error management in HTTP calls.

* clippy fixes

- Changed http_client from Arc to Rc in OidcService for improved memory efficiency.
- Updated related code to reflect the new ownership model for the HTTP client.

* initialize the oidc and http clients only once

- Added OidcState struct to encapsulate OIDC configuration and client.
- Refactored OidcMiddleware to utilize OidcState for improved state management.
- Updated HTTP client handling in OIDC service methods for better integration with app data.
- Enhanced logging for OIDC middleware initialization and request processing.

* functions for accessing user claims from OIDC tokens + documentation

- Updated SQLPage authentication component documentation for clarity on usage and options.
- Removed deprecated login and redirect handler scripts to streamline the SSO implementation.
- Enhanced logout functionality to properly clear session cookies and redirect users.
- Improved request handling to include OIDC claims in the request context for better user information retrieval.

* better sso troubleshooting info

* fmt

* add sso to the changelog
2025-05-05 17:59:07 +02:00
ppom f205b65e93 Fix SQLite examples having PostgreSQL :: syntax (#903)
According to discussion here
https://github.com/sqlpage/SQLPage/pull/897#issuecomment-2835516830

Co-authored-by: ppom <>
2025-04-29 22:22:37 +02:00
Ophir LOJKINE b05316d6d0 Update 01_documentation.sql 2025-04-28 09:57:42 +02:00
ppom 10d4c69c80 Documentation: add "Extensions to SQL" page (#897)
Fix #877

Co-authored-by: ppom <>
Co-authored-by: Ophir LOJKINE <contact@ophir.dev>
2025-04-28 09:19:23 +02:00
Amruta.org 74d5b24f9a Replace hardcoded strings with customizable attributes in multiple components (#893)
* Update shell.handlebars

adding two options:
search_button
search_placeholder

* Update table.handlebars

adding search_placeholder option

* Update 01_documentation.sql

documentation update for the shell component options:
search_placeholder
search_button
and for the table component option: search_placeholder

* avoid failing tests on long loading map tiles

* add an example for search_placeholder

---------

Co-authored-by: lovasoa <contact@ophir.dev>
2025-04-24 16:01:25 +02:00
olivierauverlot 32778bf0ad New component : Empty state (#890)
* empty_state component added

* empty_state component added

* Correction and new example

* rename status_code to header

* Enhance empty_state component documentation and template to support rich text formatting. Update docs with detailed descriptions and examples, and modify Handlebars template to conditionally render Markdown content.

* add and document class and id attributes

---------

Co-authored-by: lovasoa <contact@ophir.dev>
2025-04-24 14:51:40 +02:00
lovasoa 524c5f939a grammar 2025-04-22 11:06:47 +02:00
lovasoa 407bc81664 improve the documentation for the redirect component 2025-04-22 11:05:37 +02:00
lovasoa 05fd4d2ed3 sort imports 2025-04-21 09:12:12 +02:00
lovasoa 9a401b6106 format 2025-04-21 09:10:02 +02:00
lovasoa d6913e2b3c handle newlines, prevent duplication in lists and blockquotes, and improve line break processing in rich text editor 2025-04-21 03:22:18 +02:00
lovasoa c203af6716 refactor deltaToMarkdown and createTextNode functions for improved text handling in rich text editor 2025-04-21 03:08:24 +02:00
lovasoa 379e5a31c0 update SQL link generation and refactor deltaToMdast function for improved text processing in rich text editor 2025-04-21 02:46:45 +02:00
lovasoa 482c8e614d add code formatting option to rich text editor toolbar 2025-04-21 02:18:12 +02:00
lovasoa 8a25a90d25 add type annotations 2025-04-21 02:13:16 +02:00
lovasoa 4664c22cba clean up rich text editor code 2025-04-21 02:04:50 +02:00
lovasoa d0b60e1b0e enhance deltaToMdast function to support code blocks, blockquotes, and lists in rich text editor 2025-04-21 02:00:46 +02:00