-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d4f4bd
commit ee61fa7
Showing
12 changed files
with
186 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...ons/oidc-common/runtime/src/main/java/io/quarkus/oidc/common/OidcClientRequestFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package io.quarkus.oidc.common; | ||
|
||
import io.vertx.mutiny.core.buffer.Buffer; | ||
import io.vertx.mutiny.ext.web.client.HttpRequest; | ||
|
||
/** | ||
* Request filter which can be used to customize OIDC client requests | ||
*/ | ||
public interface OidcClientRequestFilter { | ||
/** | ||
* Filter OIDC client requests | ||
* | ||
* @param request HTTP request | ||
* @param body request body, will be null for HTTP GET methods, may be null for other HTTP methods | ||
*/ | ||
void filter(HttpRequest<Buffer> request, Buffer body); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...ests/oidc-client-wiremock/src/main/java/io/quarkus/it/keycloak/OidcRequestCustomizer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package io.quarkus.it.keycloak; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
|
||
import io.quarkus.arc.Unremovable; | ||
import io.quarkus.oidc.common.OidcClientRequestFilter; | ||
import io.vertx.mutiny.core.buffer.Buffer; | ||
import io.vertx.mutiny.ext.web.client.HttpRequest; | ||
|
||
@ApplicationScoped | ||
@Unremovable | ||
public class OidcRequestCustomizer implements OidcClientRequestFilter { | ||
|
||
@Override | ||
public void filter(HttpRequest<Buffer> request, Buffer buffer) { | ||
String uri = request.uri(); | ||
if (uri.endsWith("/non-standard-tokens")) { | ||
request.putHeader("GrantType", getGrantType(buffer.toString())); | ||
} | ||
} | ||
|
||
private String getGrantType(String formString) { | ||
for (String formValue : formString.split("&")) { | ||
if (formValue.startsWith("grant_type=")) { | ||
return formValue.substring("grant_type=".length()); | ||
} | ||
} | ||
return ""; | ||
} | ||
} |
Oops, something went wrong.