Keycloak OIDC Filter redirect_uri is always http

203 Views Asked by At

My application was developed using wicket and integrated with keycloak 10.0.2.

I have an issue with the redirect_uri, it is always in http (like https://id.dev.subok.com/auth/realms/subok/protocol/openid-connect/auth? ... &redirect_uri=http%3A%2F%2Ftest.subok.com%2F ....

To elaborate: When I try to access my app via https://test.subok.com, I am expecting that the redirect_uri will be https%3A%2F%2Ftest.subok.com%2F but it was http%3A%2F%2Ftest.subok.com%2F. The redirect_uri is always http even if I use http or https.

The way I integrate Keycloak to my application is via servlet filter:

POM

...

<dependency>
  <groupId>org.keycloak</groupId>
  <artifactId>keycloak-servlet-filter-adapter</artifactId>
  <version>10.0.2</version>
</dependency>

<dependency>
  <groupId>org.keycloak</groupId>
  <artifactId>keycloak-authz-client</artifactId>
  <version>10.0.2</version>
</dependency>

...

web.xml

...

<filter>
  <filter-name>keycloak</filter-name>
  <filter-class>org.keycloak.adapters.servlet.KeycloakOIDCFilter</filter-class>
  <init-param>
    <param-name>keycloak.config.skipPattern</param-name>
    <param-value>/((error-page.html)|(access-denied-page.html))</param-value>
  </init-param>
</filter>

<filter-mapping>
  <filter-name>keycloak</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

...

Is there a way to override the value of generated redirect_uri? Specifically to use https if the request is https and http if the request is http. Or just use https redirect_url for both http and https request?

0

There are 0 best solutions below