Skip to content

Commit

Permalink
Update Keycloak version to 22.0.0 (#15)
Browse files Browse the repository at this point in the history
* Update Keycloak version to 22.0.1
  • Loading branch information
Ansa89 authored Jul 22, 2023
1 parent 041cdc8 commit 1d5ed47
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<keycloak.version>21.1.1</keycloak.version>
<keycloak.version>22.0.1</keycloak.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import com.duosecurity.Client;
import com.duosecurity.exception.DuoException;
import com.duosecurity.model.Token;
import jakarta.ws.rs.core.MultivaluedMap;
import jakarta.ws.rs.core.Response;
import org.jboss.logging.Logger;
import org.keycloak.authentication.AuthenticationFlowContext;
import org.keycloak.authentication.AuthenticationFlowError;
Expand All @@ -11,8 +13,6 @@
import org.keycloak.models.*;
import org.keycloak.models.utils.FormMessage;

import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import java.net.URI;
import java.util.Arrays;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package com.instipod.duouniversal.getshim;

import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.MultivaluedMap;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.UriInfo;
import org.keycloak.models.KeycloakContext;
import org.keycloak.models.KeycloakSession;
import org.keycloak.services.resource.RealmResourceProvider;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.*;
import java.net.URI;
import java.net.URISyntaxException;

Expand All @@ -25,14 +29,17 @@ public Object getResource() {
@GET
@Path("/callback")
@Produces(MediaType.TEXT_HTML)
public Response get(@Context UriInfo uriInfo) {
public Response get() {
KeycloakContext context = session.getContext();
String realm = "";

try {
realm = session.getContext().getRealm().getName();
realm = context.getRealm().getName();
} catch (Exception exception) {
// leave realm blank
}

UriInfo uriInfo = context.getUri();
MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters();
if (realm.equalsIgnoreCase("") || !queryParams.containsKey("kc_execution") || !queryParams.containsKey("kc_client_id") || !queryParams.containsKey("kc_tab_id")) {
// these fields are required, throw a bad request error
Expand Down
10 changes: 5 additions & 5 deletions src/main/resources/META-INF/jboss-deployment-structure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.keycloak.keycloak-core" export="true" />
<module name="org.keycloak.keycloak-server-spi" export="true" />
<module name="org.keycloak.keycloak-server-spi-private" export="true" />
<module name="org.keycloak.keycloak-services" export="true" />
<module name="org.jboss.logging" export="true" />
<module name="org.keycloak.keycloak-core" export="true"/>
<module name="org.keycloak.keycloak-server-spi" export="true"/>
<module name="org.keycloak.keycloak-server-spi-private" export="true"/>
<module name="org.keycloak.keycloak-services" export="true"/>
<module name="org.jboss.logging" export="true"/>
</dependencies>
</deployment>
</jboss-deployment-structure>

0 comments on commit 1d5ed47

Please sign in to comment.