Skip to content

Commit bc6c086

Browse files
committed
Merge branch 'develop' into update-from-template-merged
2 parents 887e323 + 99187aa commit bc6c086

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+3608
-113
lines changed

Diff for: .github/ISSUE_TEMPLATE/bug_report.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ body:
1515
attributes:
1616
label: "Checklist"
1717
options:
18-
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/template-placeholder/releases/latest)"
18+
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/spring-security-advanced-authentication-ui/releases/latest)"
1919
required: true
20-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
20+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/spring-security-advanced-authentication-ui/issues) or [closed](https://github.com/xdev-software/spring-security-advanced-authentication-ui/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
2121
required: true
2222
- label: "I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise."
2323
required: true

Diff for: .github/ISSUE_TEMPLATE/enhancement.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ body:
1313
attributes:
1414
label: "Checklist"
1515
options:
16-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
16+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/spring-security-advanced-authentication-ui/issues) or [closed](https://github.com/xdev-software/spring-security-advanced-authentication-ui/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
1717
required: true
1818
- label: "I have taken the time to fill in all the required details. I understand that the feature request will be dismissed otherwise."
1919
required: true

Diff for: .github/ISSUE_TEMPLATE/question.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ body:
1212
attributes:
1313
label: "Checklist"
1414
options:
15-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
15+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/spring-security-advanced-authentication-ui/issues) or [closed](https://github.com/xdev-software/spring-security-advanced-authentication-ui/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
1616
required: true
1717
- label: "I have taken the time to fill in all the required details. I understand that the question will be dismissed otherwise."
1818
required: true

Diff for: .run/Run Demo.run.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<component name="ProjectRunConfigurationManager">
22
<configuration default="false" name="Run Demo" type="Application" factoryName="Application">
33
<option name="MAIN_CLASS_NAME" value="software.xdev.Application" />
4-
<module name="template-placeholder-demo" />
4+
<module name="spring-security-advanced-authentication-ui-demo" />
55
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
66
<extension name="coverage">
77
<pattern>
@@ -13,4 +13,4 @@
1313
<option name="Make" enabled="true" />
1414
</method>
1515
</configuration>
16-
</component>
16+
</component>

Diff for: CHANGELOG.md

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# 2.0.0
2+
* Added support for Spring Security 6.4+ / Spring Boot 3.4+ #100
3+
* Spring now
4+
* uses a Regex-based templating system
5+
* no longer uses bootstrap
6+
* provides One-Time token/OTT and Passkey logins
7+
* Changes to ``Extendable``-subsystem
8+
* Now uses the new Regex-based templating system
9+
* Correct a bunch of problems in Spring Security including
10+
* One-Time token/OTT and Passkeys are ignored when computing if the whole filter is enabled
11+
* [Passkeys] Removed invalid XML comment in scripts block
12+
* [Passkeys] Fixed incorrectly closed HTML-form/div-tag
13+
* [HtmlTemplating] Compile ``UNUSED_PLACEHOLDER_PATTERN`` regex once and not for each request
14+
* [HtmlTemplating] Render: Optimization: Use entrySet instead of keySet + getValue
15+
* Add correct setter for ``generateOneTimeTokenUrl``
16+
* Improved naming of methods
17+
* Changes to ``Advanced``-subsystem
18+
* Keeps using Bootstrap
19+
* By default bootstrap is still loaded from ``cdn.jsdelivr.net`` but you can (and should) provide your own version
20+
* Keeps using the old templating system (without Regex)
21+
* Not all values are escaped by default as is with Spring's Regex based system
22+
* Usually they don't need to be escaped in the first place as they are set on the server side and can't be modified by a user
23+
* This is A LOT FASTER (in tests around 50x) than Spring's new Regex based system
24+
* Adopted changes; Added new configuration options
25+
* [Passkeys] Fixed a problem where more than one header results in invalid generated JavaScript code
26+
27+
# 1.0.3
28+
* Updated dependencies
29+
* Abstracted code
30+
31+
# 1.0.2
32+
* Fix incorrect styling of ``main`` element on login screen
33+
34+
# 1.0.1
35+
* Fix NPE when ``additionalStylingData`` is not set
36+
37+
# 1.0.0
38+
<i>Initial release</i>
39+
* All methods and functionality are designed to be overwritable (at least protected)
40+
* The library consists of 2 main parts:
41+
* ``extendable`` → Includes the bare minimum to make the Spring components extendable
42+
* ``advanced`` → Contains components made on top of ``extendable`` with many customization options; Additionally:
43+
* Updated Bootstrap to version 5.3+
44+
* Improved SSO (OAuth2 / SAML2) UI

Diff for: CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ You should have the following things installed:
3434
* Ensure that the JDK/Java-Version is correct
3535

3636

37-
## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/template-placeholder/release.yml?branch=master)](https://github.com/xdev-software/template-placeholder/actions/workflows/release.yml)
37+
## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/spring-security-advanced-authentication-ui/release.yml?branch=master)](https://github.com/xdev-software/spring-security-advanced-authentication-ui/actions/workflows/release.yml)
3838

3939
Before releasing:
40-
* Consider doing a [test-deployment](https://github.com/xdev-software/template-placeholder/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
40+
* Consider doing a [test-deployment](https://github.com/xdev-software/spring-security-advanced-authentication-ui/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
4141
* Check the [changelog](CHANGELOG.md)
4242

4343
If the ``develop`` is ready for release, create a pull request to the ``master``-Branch and merge the changes

Diff for: README.md

+47-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,53 @@
1-
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/template-placeholder?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/template-placeholder)
2-
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/template-placeholder/check-build.yml?branch=develop)](https://github.com/xdev-software/template-placeholder/actions/workflows/check-build.yml?query=branch%3Adevelop)
3-
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_template-placeholder&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_template-placeholder)
1+
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/spring-security-advanced-authentication-ui?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/spring-security-advanced-authentication-ui)
2+
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/spring-security-advanced-authentication-ui/check-build.yml?branch=develop)](https://github.com/xdev-software/spring-security-advanced-authentication-ui/actions/workflows/check-build.yml?query=branch%3Adevelop)
3+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_spring-security-advanced-authentication-ui&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_spring-security-advanced-authentication-ui)
44

5-
# template-placeholder
5+
# Advanced authentication UI for Spring Security
66

7+
Modernizes the default Spring Web Authentication/Login UI and makes it easier customizable.
8+
9+
<details><summary>Show demo</summary>
10+
11+
<p align="center">
12+
<img src="./assets/demo.png" alt="Demo" />
13+
</p>
14+
15+
</details>
16+
17+
## Usage
18+
19+
The library provides an adapter that can be used like this:
20+
```java
21+
public SecurityFilterChain configure(final HttpSecurity http) throws Exception
22+
{
23+
// Changing the text "Login with" to "Sign in with"
24+
http.with(new AdvancedLoginPageAdapter<>(http), c -> c
25+
.customizeLoginPage(p -> p.ssoLoginHeaderText("Sign in with")))
26+
.oauth2Login(c ->
27+
// ...
28+
)
29+
// ...
30+
}
31+
```
32+
33+
A more detailed scenario is available in the [demo](./spring-security-advanced-authentication-ui-demo/).
34+
35+
> [!NOTE]
36+
> By default [Bootstrap](https://github.com/twbs/bootstrap) is loaded from ``cdn.jsdelivr.net``.<br/>
37+
> Due to privacy and stability reasons you should ship your own version!<br/>
38+
> An example how this can be done is shown in the [demo](https://github.com/xdev-software/spring-security-advanced-authentication-ui/blob/4117d471e036de4dc2a58b2b484f2631afe7af50/spring-security-advanced-authentication-ui-demo/src/main/java/software/xdev/security/MainWebSecurity.java#L44-L51).
39+
40+
> [!NOTE]
41+
> The ``Advanced``-subsystem uses the pre-``Spring Security 6.4`` / ``Spring Boot 3.4`` templating system (without Regex).<br/>
42+
> * In contrast to Spring's new Regex based system not all values are escaped by default
43+
> * Usually they don't need to be escaped in the first place as they are set on the server side and can't be modified by a user
44+
> * This is A LOT FASTER (in tests around 50x) than Spring's new Regex based system
745
846
## Installation
9-
[Installation guide for the latest release](https://github.com/xdev-software/template-placeholder/releases/latest#Installation)
47+
[Installation guide for the latest release](https://github.com/xdev-software/spring-security-advanced-authentication-ui/releases/latest#Installation)
48+
49+
> [!NOTE]
50+
> To minimize the risk of dependency conflicts all Spring (Boot) dependencies are declared as provided and are not shipped by default.
1051
1152
## Support
1253
If you need support as soon as possible and you can't wait for any pull request, feel free to use [our support](https://xdev.software/en/services/support).
@@ -15,4 +56,4 @@ If you need support as soon as possible and you can't wait for any pull request,
1556
See the [contributing guide](./CONTRIBUTING.md) for detailed instructions on how to get started with our project.
1657

1758
## Dependencies and Licenses
18-
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/template-placeholder/dependencies)
59+
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/spring-security-advanced-authentication-ui/dependencies)

Diff for: SECURITY.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
## Reporting a Vulnerability
44

5-
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/template-placeholder/security/advisories/new).
5+
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/spring-security-advanced-authentication-ui/security/advisories/new).

Diff for: assets/demo.png

55.9 KB
Loading

Diff for: dev_infra/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oidc-user-config.json

Diff for: dev_infra/README.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
## Development Infrastructure
2+
3+
The infrastructure contains the following:
4+
* [Open ID Connect Mock Server](https://github.com/xdev-software/oidc-server-mock) - for login in
5+
* Available at http://localhost:4011
6+
7+
### Setup
8+
* Requires Docker
9+
10+
#### OIDC
11+
* Create ``oidc-user-config.json`` from [``oidc-user-config.json.template``](./oidc-user-config.json.template)
12+
* File should not be tracked in Git
13+
* Fill in your login details like mail, name, password
14+
15+
16+
### Usage
17+
Note: Commands are all executed inside a shell/CMD in the current folder. ([Tip for windows users](https://stackoverflow.com/a/40146208))
18+
19+
| Use case | What to do? |
20+
| --- | --- |
21+
| Starting the infrastructure | ``docker compose up`` |
22+
| Stopping (and removing) the infrastructure | ``docker compose down`` |
23+
| (Re)Building the infrastructure<br/>e.g. after changes to the Dockerfiles | ``docker compose build --pull`` |
24+
25+
See also ``docker compose --help``
26+
27+
### Additional notes
28+
⚠ The containers don't automatically restart after a PC restart!
29+
30+
⚠ After a PC restart the infrastructure is still present but it's stopped.<br/>
31+
In this case you have 2 options:
32+
* start the existing infrastructure again (``docker compose up``) or
33+
* do a clean start by first removing (``docker compose down``) and then starting the infrastructure

Diff for: dev_infra/docker-compose.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
services:
2+
# Docs: https://docs.duendesoftware.com
3+
oidc-server-mock:
4+
container_name: oidc-server-mock
5+
image: xdevsoftware/oidc-server-mock:1
6+
environment:
7+
ASPNETCORE_ENVIRONMENT: Development
8+
SERVER_OPTIONS_INLINE: |
9+
{
10+
"AccessTokenJwtType": "JWT",
11+
"Discovery": {
12+
"ShowKeySet": true
13+
},
14+
"Authentication": {
15+
"CookieSameSiteMode": "Lax",
16+
"CheckSessionCookieSameSiteMode": "Lax"
17+
}
18+
}
19+
LOGIN_OPTIONS_INLINE: |
20+
{
21+
"AllowRememberLogin": false
22+
}
23+
LOGOUT_OPTIONS_INLINE: |
24+
{
25+
"AutomaticRedirectAfterSignOut": true
26+
}
27+
USERS_CONFIGURATION_PATH: /tmp/config/oidc-user-config.json
28+
CLIENTS_CONFIGURATION_INLINE: |
29+
[
30+
{
31+
"ClientId": "client-id",
32+
"ClientSecrets": [
33+
"client-secret"
34+
],
35+
"Description": "TestClient",
36+
"AllowedGrantTypes": [
37+
"authorization_code",
38+
"refresh_token"
39+
],
40+
"RedirectUris": [
41+
"*"
42+
],
43+
"AllowedScopes": [
44+
"openid",
45+
"profile",
46+
"email",
47+
"offline_access"
48+
],
49+
"AlwaysIncludeUserClaimsInIdToken": true,
50+
"AllowOfflineAccess": true,
51+
"RequirePkce": false
52+
}
53+
]
54+
ASPNET_SERVICES_OPTIONS_INLINE: |
55+
{
56+
"ForwardedHeadersOptions": {
57+
"ForwardedHeaders" : "All"
58+
}
59+
}
60+
volumes:
61+
- ./oidc-user-config.json:/tmp/config/oidc-user-config.json:ro
62+
ports:
63+
- '4011:8080'
64+
deploy:
65+
resources:
66+
limits:
67+
memory: 512m

Diff for: dev_infra/oidc-user-config.json.template

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[
2+
{
3+
"SubjectId":"1",
4+
"Username":"[email protected]",
5+
"Password":"pwd",
6+
"Claims": [
7+
{
8+
"Type": "name",
9+
"Value": "Your name",
10+
"ValueType": "string"
11+
},
12+
{
13+
"Type": "email",
14+
"Value": "[email protected]",
15+
"ValueType": "string"
16+
}
17+
]
18+
}
19+
]

Diff for: pom.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>software.xdev</groupId>
8-
<artifactId>template-placeholder-root</artifactId>
9-
<version>1.0.0-SNAPSHOT</version>
8+
<artifactId>spring-security-advanced-authentication-ui-root</artifactId>
9+
<version>2.0.1-SNAPSHOT</version>
1010
<packaging>pom</packaging>
1111

1212
<organization>
@@ -15,8 +15,8 @@
1515
</organization>
1616

1717
<modules>
18-
<module>template-placeholder</module>
19-
<module>template-placeholder-demo</module>
18+
<module>spring-security-advanced-authentication-ui</module>
19+
<module>spring-security-advanced-authentication-ui-demo</module>
2020
</modules>
2121

2222
<properties>

Diff for: renovate.json5

+11-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"packageRules": [
55
{
66
"description": "Ignore project internal dependencies",
7-
"packagePattern": "^software.xdev:template-placeholder",
7+
"packagePattern": "^software.xdev:spring-security-advanced-authentication-ui",
88
"datasources": [
99
"maven"
1010
],
@@ -19,6 +19,16 @@
1919
"maven"
2020
],
2121
"groupName": "net.sourceforge.pmd"
22+
},
23+
{
24+
"description": "Group Spring Boot",
25+
"matchPackagePatterns": [
26+
"^org.springframework.boot"
27+
],
28+
"datasources": [
29+
"maven"
30+
],
31+
"groupName": "org.springframework.boot"
2232
}
2333
]
2434
}
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Demo
2+
3+
* Start the [development infrastructure](../dev_infra/)
4+
* Run the application
5+
* Open ``http://localhost:8080``
6+
7+
## Special Login information
8+
9+
### Username + Password
10+
11+
Example user:
12+
* Username: ``test``
13+
* Password: ``test``
14+
15+
### Passkeys
16+
17+
The browser needs to support passkeys and you also need an appropriate store (usually the OS handles this).
18+
19+
NOTE: Passkeys are lost when rebooting the server

0 commit comments

Comments
 (0)