Skip to content

Commit 8036c70

Browse files
tomas-langerbarchetta
authored andcommitted
Updated examples to use the new /* pattern for "any subpath" instead of the old, more convoluted one ([/{*}]) (#160)
1 parent c72f74c commit 8036c70

File tree

10 files changed

+23
-23
lines changed

10 files changed

+23
-23
lines changed

examples/microprofile/idcs/src/main/resources/application.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2018, 2024 Oracle and/or its affiliates.
2+
# Copyright (c) 2018, 2025 Oracle and/or its affiliates.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@ security:
5757
identity-uri: "${security.properties.idcs-uri}"
5858
web-server:
5959
paths:
60-
- path: "/web[/{*}]"
60+
- path: "/web/*"
6161
authenticate: true
62-
- path: "/service[/{*}]"
62+
- path: "/service/*"
6363
authenticate: true

examples/microprofile/security/src/main/resources/application.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2018, 2024 Oracle and/or its affiliates.
2+
# Copyright (c) 2018, 2025 Oracle and/or its affiliates.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -36,5 +36,5 @@ security:
3636
password: "changeit"
3737
web-server:
3838
paths:
39-
- path: "/static-cp[/{*}]"
39+
- path: "/static-cp/*"
4040
authenticate: true

examples/security/attribute-based-access-control/src/main/resources/application.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2017, 2024 Oracle and/or its affiliates.
2+
# Copyright (c) 2017, 2025 Oracle and/or its affiliates.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -66,7 +66,7 @@ security:
6666
- path: "/noRoles"
6767
methods: ["get"]
6868
authenticate: true
69-
- path: "/user[/{*}]"
69+
- path: "/user/*"
7070
methods: ["get"]
7171
# implies authentication and authorization
7272
abac:

examples/security/basic-auth-with-static-content/src/main/java/io/helidon/examples/security/basicauth/BasicExampleBuilderMain.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,17 @@ static void setup(WebServerConfig.Builder server) {
107107
.build())
108108
.routing(routing -> routing
109109
// must be configured first, to protect endpoints
110-
.any("/static[/{*}]", SecurityFeature.rolesAllowed("user"))
110+
.any("/static/*", SecurityFeature.rolesAllowed("user"))
111111
.get("/noRoles", SecurityFeature.enforce())
112-
.get("/user[/{*}]", SecurityFeature.rolesAllowed("user"))
112+
.get("/user/*", SecurityFeature.rolesAllowed("user"))
113113
.get("/admin", SecurityFeature.rolesAllowed("admin"))
114114
// audit is not enabled for GET methods by default
115115
.get("/deny", SecurityFeature.rolesAllowed("deny").audit())
116116
// roles allowed imply authn and authz
117117
.any("/noAuthn", SecurityFeature.rolesAllowed("admin")
118118
.authenticationOptional()
119119
.audit())
120-
.get("/{*}", (req, res) -> {
120+
.get("/*", (req, res) -> {
121121
Optional<SecurityContext> securityContext = req.context().get(SecurityContext.class);
122122
res.headers().contentType(HttpMediaTypes.PLAINTEXT_UTF_8);
123123
res.send("Hello, you are: \n" + securityContext

examples/security/basic-auth-with-static-content/src/main/java/io/helidon/examples/security/basicauth/BasicExampleConfigMain.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static void setup(WebServerConfig.Builder server) {
8686
.welcome("index.html"))
8787
.build())
8888
.routing(routing -> routing
89-
.get("/{*}", (req, res) -> {
89+
.get("/*", (req, res) -> {
9090
Optional<SecurityContext> securityContext = req.context().get(SecurityContext.class);
9191
res.headers().contentType(HttpMediaTypes.PLAINTEXT_UTF_8);
9292
res.send("Hello, you are: \n" + securityContext

examples/security/basic-auth-with-static-content/src/main/resources/application.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2020, 2024 Oracle and/or its affiliates.
2+
# Copyright (c) 2020, 2025 Oracle and/or its affiliates.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@ server:
2626
paths:
2727
- path: "/noRoles"
2828
methods: [ "get" ]
29-
- path: "/user[/{*}]"
29+
- path: "/user/*"
3030
methods: [ "get" ]
3131
roles-allowed: [ "user" ]
3232
- path: "/admin"
@@ -40,7 +40,7 @@ server:
4040
roles-allowed: [ "admin" ]
4141
authentication-optional: true
4242
audit: true
43-
- path: "/static[/{*}]"
43+
- path: "/static/*"
4444
roles-allowed: "user"
4545

4646
security:

examples/security/webserver-digest-auth/src/main/java/io/helidon/examples/security/digest/DigestExampleBuilderMain.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2024 Oracle and/or its affiliates.
2+
* Copyright (c) 2018, 2025 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -105,15 +105,15 @@ static void setup(WebServerConfig.Builder server) {
105105
.build())
106106
.routing(routing -> routing
107107
.get("/noRoles", SecurityFeature.enforce())
108-
.get("/user[/{*}]", SecurityFeature.rolesAllowed("user"))
108+
.get("/user/*", SecurityFeature.rolesAllowed("user"))
109109
.get("/admin", SecurityFeature.rolesAllowed("admin"))
110110
// audit is not enabled for GET methods by default
111111
.get("/deny", SecurityFeature.rolesAllowed("deny").audit())
112112
// roles allowed imply authn and authz
113113
.any("/noAuthn", SecurityFeature.rolesAllowed("admin")
114114
.authenticationOptional()
115115
.audit())
116-
.get("/{*}", (req, res) -> {
116+
.get("/*", (req, res) -> {
117117
Optional<SecurityContext> securityContext = req.context().get(SecurityContext.class);
118118
res.headers().contentType(HttpMediaTypes.PLAINTEXT_UTF_8);
119119
res.send("Hello, you are: \n" + securityContext

examples/security/webserver-digest-auth/src/main/java/io/helidon/examples/security/digest/DigestExampleConfigMain.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2024 Oracle and/or its affiliates.
2+
* Copyright (c) 2018, 2025 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -79,7 +79,7 @@ static void setup(WebServerConfig.Builder server) {
7979
server.config(config.get("server"))
8080
.routing(routing -> routing
8181
// web server does not (yet) have possibility to configure routes in config files, so explicit...
82-
.get("/{*}", (req, res) -> {
82+
.get("/*", (req, res) -> {
8383
Optional<SecurityContext> securityContext = req.context().get(SecurityContext.class);
8484
res.headers().contentType(HttpMediaTypes.PLAINTEXT_UTF_8);
8585
res.send("Hello, you are: \n" + securityContext

examples/security/webserver-digest-auth/src/main/resources/application.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2016, 2024 Oracle and/or its affiliates.
2+
# Copyright (c) 2016, 2025 Oracle and/or its affiliates.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@ server:
2323
paths:
2424
- path: "/noRoles"
2525
methods: [ "get" ]
26-
- path: "/user[/{*}]"
26+
- path: "/user/*"
2727
methods: [ "get" ]
2828
roles-allowed: [ "user" ]
2929
- path: "/admin"

examples/security/webserver-signatures/src/main/java/io/helidon/examples/security/signatures/Service2.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, 2024 Oracle and/or its affiliates.
2+
* Copyright (c) 2023, 2025 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@ class Service2 implements HttpService {
2929

3030
@Override
3131
public void routing(HttpRules rules) {
32-
rules.get("/{*}", this::handle);
32+
rules.get("/*", this::handle);
3333
}
3434

3535
private void handle(ServerRequest req, ServerResponse res) {

0 commit comments

Comments
 (0)