-
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.
Merge pull request #26608 from sberyozkin/keycloak_authorization_prox…
…y_scheme Strip the scheme value from the OIDC proxy host
- Loading branch information
Showing
4 changed files
with
64 additions
and
3 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
45 changes: 45 additions & 0 deletions
45
...oidc-common/runtime/src/test/java/io/quarkus/oidc/common/runtime/OidcCommonUtilsTest.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,45 @@ | ||
package io.quarkus.oidc.common.runtime; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import java.net.URI; | ||
import java.util.Optional; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.vertx.core.net.ProxyOptions; | ||
|
||
public class OidcCommonUtilsTest { | ||
|
||
@Test | ||
public void testProxyOptionsWithHostWithoutScheme() throws Exception { | ||
OidcCommonConfig.Proxy config = new OidcCommonConfig.Proxy(); | ||
config.host = Optional.of("localhost"); | ||
config.port = 8080; | ||
config.username = Optional.of("user"); | ||
config.password = Optional.of("password"); | ||
|
||
ProxyOptions options = OidcCommonUtils.toProxyOptions(config).get(); | ||
assertEquals("localhost", options.getHost()); | ||
assertEquals(8080, options.getPort()); | ||
assertEquals("user", options.getUsername()); | ||
assertEquals("password", options.getPassword()); | ||
} | ||
|
||
@Test | ||
public void testProxyOptionsWithHostWithScheme() throws Exception { | ||
OidcCommonConfig.Proxy config = new OidcCommonConfig.Proxy(); | ||
config.host = Optional.of("http://localhost"); | ||
config.port = 8080; | ||
config.username = Optional.of("user"); | ||
config.password = Optional.of("password"); | ||
|
||
assertEquals("http", URI.create(config.host.get()).getScheme()); | ||
|
||
ProxyOptions options = OidcCommonUtils.toProxyOptions(config).get(); | ||
assertEquals("localhost", options.getHost()); | ||
assertEquals(8080, options.getPort()); | ||
assertEquals("user", options.getUsername()); | ||
assertEquals("password", options.getPassword()); | ||
} | ||
} |