Skip to content

Commit

Permalink
port to 25 (#78)
Browse files Browse the repository at this point in the history
* port to 25

* removed build step from release yaml.
  • Loading branch information
xgp authored Jun 19, 2024
1 parent c6723a1 commit 305f815
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 40 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Build and Test
uses: qcastel/github-actions-maven-cmd@master
with:
maven-args: "clean install -Dmaven.test.skip=true -Ddockerfile.skip -DdockerCompose.skip -Djib.skip"

- name: Release
uses: qcastel/github-actions-maven-release@master
with:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,5 @@ User contributed POC using Jupyter: https://github.com/tstec-polypoly/explore-ke

---

All documentation, source code and other files in this repository are Copyright 2023 Phase Two, Inc.
All documentation, source code and other files in this repository are Copyright 2024 Phase Two, Inc.

36 changes: 9 additions & 27 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
</licenses>

<properties>
<java.version>17</java.version>
<java.version>21</java.version>
<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>24.0.0</keycloak.version>
<lombok.version>1.18.30</lombok.version>
<keycloak.version>25.0.0</keycloak.version>
<lombok.version>1.18.32</lombok.version>
<auto-service.version>1.1.1</auto-service.version>
<ossrh.url>https://s01.oss.sonatype.org</ossrh.url>
</properties>
Expand All @@ -45,29 +45,6 @@
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
</excludes>
</filter>
</filters>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down Expand Up @@ -109,6 +86,11 @@
<versionCommit>${buildNumber}</versionCommit>
</configuration>
</plugin>
<plugin> <!-- pretty up the code using google java standards `mvn fmt:format` -->
<groupId>com.spotify.fmt</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>2.23</version>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -149,7 +131,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.0.1-jre</version>
<version>33.0.0-jre</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ public Response handleToken(
rootAuthenticationSession.getAuthenticationSession(client, token.getTabId());
if (authenticationFlowSession != null) {
authenticationFlowSession.setAuthNote(SESSION_CONFIRMED, "true");
Cookie cookie = session.getContext().getRequestHeaders().getCookies().get(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 @@ -4,7 +4,6 @@
import jakarta.ws.rs.core.Response;
import lombok.extern.jbosslog.JBossLog;
import org.keycloak.http.HttpRequest;
import org.keycloak.http.HttpResponse;
import org.keycloak.models.KeycloakSession;
import org.keycloak.services.cors.Cors;
import org.keycloak.services.resources.admin.AdminAuth;
Expand All @@ -28,17 +27,15 @@ public CorsResource(KeycloakSession session, HttpRequest request) {
@Path("{any:.*}")
public Response preflight() {
log.debug("CORS OPTIONS preflight request");
return Cors.add(request, Response.ok()).auth().allowedMethods(METHODS).preflight().build();
return Cors.builder().auth().allowedMethods(METHODS).preflight().add(Response.ok());
}

public static void setupCors(KeycloakSession session, AdminAuth auth) {
HttpRequest request = session.getContext().getHttpRequest();
HttpResponse response = session.getContext().getHttpResponse();
Cors.add(request)
Cors.builder()
.allowedOrigins(auth.getToken())
.allowedMethods(METHODS)
.exposedHeaders("Location")
.auth()
.build(response);
.add();
}
}

0 comments on commit 305f815

Please sign in to comment.