You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The link:https://github.com/cuioss/cui-jsf-components/blob/main/modules/cui-jsf-bootstrap/src/main/java/de/cuioss/jsf/bootstrap/tooltip/TooltipComponent.java[TooltipComponent] in the Bootstrap module is an example of a decorator that adds tooltip functionality to its parent component:
163
-
164
-
[source,java]
165
-
----
166
-
public class TooltipComponent extends AbstractParentDecorator {
167
-
168
-
// Tooltip configuration properties...
169
-
170
-
@Override
171
-
protected void decorate(UIComponent parent) {
172
-
// Add tooltip-related attributes and behaviors to the parent
The link:https://github.com/cuioss/cui-jsf-components/blob/main/modules/cui-jsf-bootstrap/src/main/java/de/cuioss/jsf/bootstrap/tooltip/TooltipComponent.java[TooltipComponent] in the Bootstrap module is a decorator that adds tooltip functionality to its parent component.
185
161
186
162
Usage:
187
163
@@ -194,30 +170,42 @@ Usage:
194
170
195
171
=== ModalControl (Bootstrap Module)
196
172
197
-
The link:https://github.com/cuioss/cui-jsf-components/blob/main/modules/cui-jsf-bootstrap/src/main/java/de/cuioss/jsf/bootstrap/modal/ModalControl.java[ModalControl] decorator adds modal dialog control functionality to buttons:
173
+
The link:https://github.com/cuioss/cui-jsf-components/blob/main/modules/cui-jsf-bootstrap/src/main/java/de/cuioss/jsf/bootstrap/modal/ModalControl.java[ModalControl] decorator adds modal dialog control functionality to buttons.
198
174
199
-
[source,java]
175
+
Usage:
176
+
177
+
[source,xml]
178
+
----
179
+
<h:commandButton value="Open Modal">
180
+
<cui:modalControl target="myModalId"/>
181
+
</h:commandButton>
200
182
----
201
-
public class ModalControl extends AbstractParentDecorator {
The link:https://github.com/cuioss/cui-jsf-components/blob/main/modules/cui-jsf-core-components/src/main/java/de/cuioss/jsf/components/blockelement/BlockElementDecorator.java[BlockElementDecorator] adds functionality to disable a component and show a loading spinner during Ajax operations.
187
+
188
+
Usage:
189
+
190
+
[source,xml]
191
+
----
192
+
<boot:commandButton value="Submit">
193
+
<f:ajax render="@this"/>
194
+
<cui:blockElement/>
195
+
</boot:commandButton>
212
196
----
213
197
198
+
=== TypewatchComponent (Core Components Module)
199
+
200
+
The link:https://github.com/cuioss/cui-jsf-components/blob/main/modules/cui-jsf-core-components/src/main/java/de/cuioss/jsf/components/typewatch/TypewatchComponent.java[TypewatchComponent] monitors user input and triggers an action after the user stops typing for a specified period.
Copy file name to clipboardExpand all lines: modules/cui-jsf-api/doc/components-partial.adoc
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,7 @@ toc::[]
13
13
== Overview
14
14
15
15
The partial implementation pattern is a design approach that follows the composite pattern to create flexible and reusable JSF components. Instead of relying heavily on inheritance, which can lead to complex class hierarchies, this pattern uses composition to combine specific behaviors into complete components.
16
+
Another commonly used Anti-Pattern for component design is copy-pasting.
16
17
17
18
The `de.cuioss.jsf.api.components.partial` package contains provider interfaces and their implementations for common component attributes and behaviors. Many component implementations in the CUI JSF framework use these partial implementations to reduce code duplication and maintain consistency across the component library.
18
19
@@ -25,6 +26,7 @@ Provider interfaces define contracts for specific component behaviors. Each inte
25
26
=== Implementations
26
27
27
28
Concrete implementations of these interfaces provide the actual behavior. These implementations typically use the `CuiState` helper to manage component state in a JSF-friendly way.
29
+
`CuiState` extends OmniFaces's `StateHelper` and provides additional convenience methods for using component state.
Copy file name to clipboardExpand all lines: modules/cui-jsf-api/doc/security-sanitization.adoc
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,16 @@ toc::[]
14
14
15
15
Web applications are vulnerable to Cross-Site Scripting (XSS) attacks when they display user-provided content without proper sanitization. The CUI JSF API provides a comprehensive set of tools to sanitize HTML content, preventing XSS vulnerabilities while allowing legitimate HTML formatting when needed.
16
16
17
+
== JSF Default Escaping
18
+
19
+
It's important to note that JSF, by design, provides default escaping for output, which helps prevent XSS attacks. However, it is still sensible to add sanitization as another line of defense, especially in the following scenarios:
20
+
21
+
1. When other clients are working on the same data that might not have the same built-in protections
22
+
2. When a developer explicitly sets `escape="false"` on JSF components
23
+
3. As part of a defense-in-depth security strategy
24
+
25
+
This multi-layered approach to security ensures that your application remains protected even if one layer is bypassed or disabled.
26
+
17
27
== CuiSanitizer
18
28
19
29
The `CuiSanitizer` enum is the core component of the security framework. It provides predefined sanitization policies based on the OWASP HTML Sanitizer library, offering different levels of HTML element and attribute filtering.
@@ -265,6 +275,7 @@ Some sanitizers preserve HTML entities, which can be useful for displaying speci
265
275
266
276
Sanitization adds some processing overhead. For high-performance applications, consider caching sanitized content when appropriate.
267
277
278
+
268
279
== Conclusion
269
280
270
281
The CUI JSF API provides a comprehensive framework for HTML sanitization through the `CuiSanitizer` enum and corresponding converters. By using these tools consistently, you can protect your application from XSS attacks while still allowing rich HTML content when needed.
0 commit comments