Skip to content

Commit

Permalink
Merge pull request #38779 from sberyozkin/oidc_endpoint_annotation_issue
Browse files Browse the repository at this point in the history
Fix OidcEndpoint annotation processing
  • Loading branch information
gsmet authored Feb 14, 2024
2 parents 6182f88 + 7c74b90 commit 1b597a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import io.quarkus.arc.Arc;
import io.quarkus.arc.ArcContainer;
import io.quarkus.arc.ClientProxy;
import io.quarkus.credentials.CredentialsProvider;
import io.quarkus.credentials.runtime.CredentialsProviderFinder;
import io.quarkus.oidc.common.OidcEndpoint;
Expand Down Expand Up @@ -496,7 +497,7 @@ public static Map<OidcEndpoint.Type, List<OidcRequestFilter>> getOidcRequestFilt
Map<OidcEndpoint.Type, List<OidcRequestFilter>> map = new HashMap<>();
for (OidcRequestFilter filter : container.listAll(OidcRequestFilter.class).stream().map(handle -> handle.get())
.collect(Collectors.toList())) {
OidcEndpoint endpoint = filter.getClass().getAnnotation(OidcEndpoint.class);
OidcEndpoint endpoint = ClientProxy.unwrap(filter).getClass().getAnnotation(OidcEndpoint.class);
OidcEndpoint.Type type = endpoint != null ? endpoint.value() : OidcEndpoint.Type.ALL;
map.computeIfAbsent(type, k -> new ArrayList<OidcRequestFilter>()).add(filter);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import jakarta.enterprise.context.ApplicationScoped;

import io.quarkus.arc.Unremovable;
import io.quarkus.oidc.OIDCException;
import io.quarkus.oidc.common.OidcEndpoint;
import io.quarkus.oidc.common.OidcEndpoint.Type;
import io.quarkus.oidc.common.OidcRequestContextProperties;
Expand All @@ -17,6 +18,9 @@ public class OidcDiscoveryRequestCustomizer implements OidcRequestFilter {

@Override
public void filter(HttpRequest<Buffer> request, Buffer buffer, OidcRequestContextProperties contextProps) {
if (!request.uri().endsWith(".well-known/openid-configuration")) {
throw new OIDCException("Filter is applied to the wrong endpoint: " + request.uri());
}
request.putHeader("Discovery", "OK");
}
}

0 comments on commit 1b597a8

Please sign in to comment.