Skip to content

Commit e701f48

Browse files
authored
Merge pull request #46316 from michalvavrik/feature/drop-security-extension-deprecations
Drop couple of deprecated build items and a field in Security and Vert.x HTTP Security area, mark `redirect-after-login` for removal
2 parents 675e2be + eda2949 commit e701f48

File tree

12 files changed

+16
-150
lines changed

12 files changed

+16
-150
lines changed

extensions/amazon-lambda-http/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpAuthenticationMechanism.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public Set<Class<? extends AuthenticationRequest>> getCredentialTypes() {
9595
}
9696

9797
@Override
98-
public HttpCredentialTransport getCredentialTransport() {
99-
return null;
98+
public Uni<HttpCredentialTransport> getCredentialTransport(RoutingContext context) {
99+
return Uni.createFrom().nullItem();
100100
}
101101
}

extensions/amazon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpAuthenticationMechanism.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public Set<Class<? extends AuthenticationRequest>> getCredentialTypes() {
9595
}
9696

9797
@Override
98-
public HttpCredentialTransport getCredentialTransport() {
99-
return null;
98+
public Uni<HttpCredentialTransport> getCredentialTransport(RoutingContext context) {
99+
return Uni.createFrom().nullItem();
100100
}
101101
}

extensions/elytron-security-oauth2/runtime/src/main/java/io/quarkus/elytron/security/oauth2/runtime/auth/OAuth2AuthMechanism.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public Set<Class<? extends AuthenticationRequest>> getCredentialTypes() {
7272
}
7373

7474
@Override
75-
public HttpCredentialTransport getCredentialTransport() {
76-
return new HttpCredentialTransport(HttpCredentialTransport.Type.AUTHORIZATION, "bearer");
75+
public Uni<HttpCredentialTransport> getCredentialTransport(RoutingContext context) {
76+
return Uni.createFrom().item(new HttpCredentialTransport(HttpCredentialTransport.Type.AUTHORIZATION, "bearer"));
7777
}
7878
}

extensions/elytron-security-properties-file/deployment/src/test/java/io/quarkus/security/test/CustomAuth.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public Set<Class<? extends AuthenticationRequest>> getCredentialTypes() {
8888
}
8989

9090
@Override
91-
public HttpCredentialTransport getCredentialTransport() {
92-
return new HttpCredentialTransport(HttpCredentialTransport.Type.AUTHORIZATION, "basic");
91+
public Uni<HttpCredentialTransport> getCredentialTransport(RoutingContext context) {
92+
return Uni.createFrom().item(new HttpCredentialTransport(HttpCredentialTransport.Type.AUTHORIZATION, "basic"));
9393
}
9494
}

extensions/security/deployment/src/main/java/io/quarkus/security/deployment/SecurityProcessor.java

-21
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@
123123
import io.quarkus.security.runtime.interceptor.SecurityCheckStorageBuilder;
124124
import io.quarkus.security.runtime.interceptor.SecurityConstrainer;
125125
import io.quarkus.security.runtime.interceptor.SecurityHandler;
126-
import io.quarkus.security.spi.AdditionalSecuredClassesBuildItem;
127126
import io.quarkus.security.spi.AdditionalSecuredMethodsBuildItem;
128127
import io.quarkus.security.spi.AdditionalSecurityAnnotationBuildItem;
129128
import io.quarkus.security.spi.AdditionalSecurityConstrainerEventPropsBuildItem;
@@ -522,26 +521,6 @@ void registerSecurityInterceptors(BuildProducer<InterceptorBindingRegistrarBuild
522521
.done());
523522
}
524523

525-
/**
526-
* Transform deprecated {@link AdditionalSecuredClassesBuildItem} to {@link AdditionalSecuredMethodsBuildItem}.
527-
*/
528-
@BuildStep
529-
void transformAdditionalSecuredClassesToMethods(List<AdditionalSecuredClassesBuildItem> additionalSecuredClassesBuildItems,
530-
BuildProducer<AdditionalSecuredMethodsBuildItem> additionalSecuredMethodsBuildItemBuildProducer) {
531-
for (AdditionalSecuredClassesBuildItem additionalSecuredClassesBuildItem : additionalSecuredClassesBuildItems) {
532-
final Collection<MethodInfo> securedMethods = new ArrayList<>();
533-
for (ClassInfo additionalSecuredClass : additionalSecuredClassesBuildItem.additionalSecuredClasses) {
534-
for (MethodInfo method : additionalSecuredClass.methods()) {
535-
if (isPublicNonStaticNonConstructor(method)) {
536-
securedMethods.add(method);
537-
}
538-
}
539-
}
540-
additionalSecuredMethodsBuildItemBuildProducer.produce(
541-
new AdditionalSecuredMethodsBuildItem(securedMethods, additionalSecuredClassesBuildItem.rolesAllowed));
542-
}
543-
}
544-
545524
/*
546525
* The annotation store is not meant to be generally supported for security annotation.
547526
* It is only used here in order to be able to register the DenyAllInterceptor for

extensions/security/spi/src/main/java/io/quarkus/security/spi/AdditionalSecuredClassesBuildItem.java

-33
This file was deleted.

extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/HttpSecurityPolicyBuildItem.java

-30
This file was deleted.

extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/HttpSecurityProcessor.java

-20
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
import io.quarkus.vertx.http.runtime.security.FormAuthenticationMechanism;
7474
import io.quarkus.vertx.http.runtime.security.HttpAuthenticator;
7575
import io.quarkus.vertx.http.runtime.security.HttpAuthorizer;
76-
import io.quarkus.vertx.http.runtime.security.HttpSecurityPolicy;
7776
import io.quarkus.vertx.http.runtime.security.HttpSecurityRecorder;
7877
import io.quarkus.vertx.http.runtime.security.HttpSecurityRecorder.AuthenticationHandler;
7978
import io.quarkus.vertx.http.runtime.security.MtlsAuthenticationMechanism;
@@ -90,28 +89,9 @@
9089
public class HttpSecurityProcessor {
9190

9291
private static final DotName AUTH_MECHANISM_NAME = DotName.createSimple(HttpAuthenticationMechanism.class);
93-
private static final DotName BASIC_AUTH_MECH_NAME = DotName.createSimple(BasicAuthenticationMechanism.class);
9492
private static final DotName BASIC_AUTH_ANNOTATION_NAME = DotName.createSimple(BasicAuthentication.class);
9593
private static final String KOTLIN_SUSPEND_IMPL_SUFFIX = "$suspendImpl";
9694

97-
@Record(ExecutionTime.STATIC_INIT)
98-
@BuildStep
99-
void produceNamedHttpSecurityPolicies(List<HttpSecurityPolicyBuildItem> httpSecurityPolicyBuildItems,
100-
BuildProducer<SyntheticBeanBuildItem> syntheticBeanProducer,
101-
HttpSecurityRecorder recorder) {
102-
if (!httpSecurityPolicyBuildItems.isEmpty()) {
103-
httpSecurityPolicyBuildItems.forEach(item -> syntheticBeanProducer
104-
.produce(SyntheticBeanBuildItem
105-
.configure(HttpSecurityPolicy.class)
106-
.named(HttpSecurityPolicy.class.getName() + "." + item.getName())
107-
.runtimeValue(recorder.createNamedHttpSecurityPolicy(item.getPolicySupplier(), item.getName()))
108-
.addType(HttpSecurityPolicy.class)
109-
.scope(Singleton.class)
110-
.unremovable()
111-
.done()));
112-
}
113-
}
114-
11595
@BuildStep
11696
@Record(ExecutionTime.STATIC_INIT)
11797
AdditionalBeanBuildItem initFormAuth(

extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/security/HeaderAuthenticator.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public Set<Class<? extends AuthenticationRequest>> getCredentialTypes() {
3838
}
3939

4040
@Override
41-
public HttpCredentialTransport getCredentialTransport() {
42-
return null;
41+
public Uni<HttpCredentialTransport> getCredentialTransport(RoutingContext context) {
42+
return Uni.createFrom().nullItem();
4343
}
4444
}

extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/FormAuthRuntimeConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ enum CookieSameSite {
5858
* if there is no landing page.
5959
*/
6060
@WithDefault("true")
61-
@Deprecated
61+
@Deprecated(forRemoval = true, since = "2.16")
6262
boolean redirectAfterLogin();
6363

6464
/**

extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpSecurityRecorder.java

-18
Original file line numberDiff line numberDiff line change
@@ -129,24 +129,6 @@ public EagerSecurityInterceptorStorage get() {
129129
};
130130
}
131131

132-
public RuntimeValue<HttpSecurityPolicy> createNamedHttpSecurityPolicy(Supplier<HttpSecurityPolicy> policySupplier,
133-
String name) {
134-
return new RuntimeValue<>(new HttpSecurityPolicy() {
135-
private final HttpSecurityPolicy delegate = policySupplier.get();
136-
137-
@Override
138-
public Uni<CheckResult> checkPermission(RoutingContext request, Uni<SecurityIdentity> identity,
139-
AuthorizationRequestContext requestContext) {
140-
return delegate.checkPermission(request, identity, requestContext);
141-
}
142-
143-
@Override
144-
public String name() {
145-
return name;
146-
}
147-
});
148-
}
149-
150132
public Supplier<Map<String, Object>> createAdditionalSecEventPropsSupplier() {
151133
return new Supplier<Map<String, Object>>() {
152134
@Override

extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/ImmutablePathMatcher.java

+5-17
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public PathMatch<T> match(String path) {
5555
if (hasExactPathMatches) {
5656
T match = exactPathMatches.get(path);
5757
if (match != null) {
58-
return new PathMatch<>(path, "", match);
58+
return new PathMatch<>(path, match);
5959
}
6060
}
6161

@@ -64,7 +64,7 @@ public PathMatch<T> match(String path) {
6464
if (pathLength == length) {
6565
SubstringMatch<T> next = paths.get(path, length);
6666
if (next != null) {
67-
return new PathMatch<>(path, "", next.getValue());
67+
return new PathMatch<>(path, next.getValue());
6868
}
6969
} else if (pathLength < length) {
7070
char c = path.charAt(pathLength);
@@ -76,12 +76,12 @@ public PathMatch<T> match(String path) {
7676
//String part = path.substring(0, pathLength);
7777
SubstringMatch<T> next = paths.get(path, pathLength);
7878
if (next != null) {
79-
return new PathMatch<>(next.getKey(), path.substring(pathLength), next.getValue());
79+
return new PathMatch<>(next.getKey(), next.getValue());
8080
}
8181
}
8282
}
8383
}
84-
return new PathMatch<>("", path, defaultHandler);
84+
return new PathMatch<>("", defaultHandler);
8585
}
8686

8787
public static <T> ImmutablePathMatcherBuilder<T> builder() {
@@ -90,25 +90,13 @@ public static <T> ImmutablePathMatcherBuilder<T> builder() {
9090

9191
public static final class PathMatch<T> {
9292
private final String matched;
93-
private final String remaining;
9493
private final T value;
9594

96-
public PathMatch(String matched, String remaining, T value) {
95+
public PathMatch(String matched, T value) {
9796
this.matched = matched;
98-
this.remaining = remaining;
9997
this.value = value;
10098
}
10199

102-
/**
103-
* @deprecated because it can't be supported with inner wildcard without cost. It's unlikely this method is
104-
* used by anyone as users don't get in touch with this class. If there is legit use case, please
105-
* open Quarkus issue.
106-
*/
107-
@Deprecated
108-
public String getRemaining() {
109-
return remaining;
110-
}
111-
112100
public String getMatched() {
113101
return matched;
114102
}

0 commit comments

Comments
 (0)