Skip to content

Commit

Permalink
Updated to keycloak 24 (#70)
Browse files Browse the repository at this point in the history
* updated to keycloak 24

* fixed Cors class not found

* fixed depreciated getCookie

* fixed token host bug on keycloak 24

* Revert "fixed token host bug on keycloak 24"

This reverts commit 6fe08f9.

* added reusable parameter to README

* fixed typo in readme
  • Loading branch information
redabourial authored Mar 21, 2024
1 parent ff95780 commit f048777
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Parameters:
| `nonce` | N | | OIDC `nonce` variable. |
| `state` | N | | OIDC `state` variable. |
| `remember_me` | N | false | If the user is treated as if they had checked "Remember Me" on login. Requires that it is enabled in the Realm. |
| `reusable` | N | true | If the token can be reused multiple times during its validity |

Sample request (replace your access token):
```
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<main.java.package>io.phasetwo.keycloak.magic</main.java.package>
<junit.version>4.13.2</junit.version>
<keycloak.version>23.0.3</keycloak.version>
<keycloak.version>24.0.0</keycloak.version>
<lombok.version>1.18.30</lombok.version>
<auto-service.version>1.1.1</auto-service.version>
<ossrh.url>https://s01.oss.sonatype.org</ossrh.url>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.phasetwo.keycloak.magic.auth.token;

import static io.phasetwo.keycloak.magic.auth.util.MagicLinkConstants.SESSION_CONFIRMED;
import static org.keycloak.services.util.CookieHelper.getCookie;

import io.phasetwo.keycloak.magic.auth.model.MagicLinkContinuationBean;
import io.phasetwo.keycloak.magic.auth.util.MagicLinkConstants;
Expand Down Expand Up @@ -58,11 +57,7 @@ public Response handleToken(
rootAuthenticationSession.getAuthenticationSession(client, token.getTabId());
if (authenticationFlowSession != null) {
authenticationFlowSession.setAuthNote(SESSION_CONFIRMED, "true");

Cookie cookie =
getCookie(
session.getContext().getRequestHeaders().getCookies(),
MagicLinkConstants.AUTH_SESSION_ID);
Cookie cookie = session.getContext().getRequestHeaders().getCookies().get(MagicLinkConstants.AUTH_SESSION_ID);

boolean sameBrowser = cookie != null && cookie.getValue().equals(token.getSessionId());
MagicLinkContinuationBean magicLinkContinuationBean =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.keycloak.http.HttpRequest;
import org.keycloak.http.HttpResponse;
import org.keycloak.models.KeycloakSession;
import org.keycloak.services.resources.Cors;
import org.keycloak.services.cors.Cors;
import org.keycloak.services.resources.admin.AdminAuth;

@JBossLog
Expand Down

0 comments on commit f048777

Please sign in to comment.