Skip to content

Commit

Permalink
update to 26.0.2 and changed processTemplate reflection (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
xgp authored Oct 26, 2024
1 parent c80cd3e commit fc3cc3e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
22 changes: 19 additions & 3 deletions ext/main/java/io/phasetwo/wizard/WizardResourceProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ public Response wizard() {
.setAttribute("realmName", realm.getName());
FreeMarkerLoginFormsProvider fm = (FreeMarkerLoginFormsProvider) form;
try {
Method processTemplateMethod =
fm.getClass()
.getDeclaredMethod("processTemplate", Theme.class, String.class, Locale.class);
Method processTemplateMethod = getProcessTemplateMethod(fm);
processTemplateMethod.setAccessible(true);
Response resp =
(Response)
Expand All @@ -114,6 +112,24 @@ public Response wizard() {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
}

Method getProcessTemplateMethod(FreeMarkerLoginFormsProvider provider)
throws NoSuchMethodException {
Class<?> clazz = provider.getClass();
StringBuilder o = new StringBuilder();
while (clazz != null) {
o.append(clazz.getSimpleName()).append("->");
try {
Method method =
clazz.getDeclaredMethod("processTemplate", Theme.class, String.class, Locale.class);
return method;
} catch (NoSuchMethodException ignore) {
}
clazz = clazz.getSuperclass();
}
throw new NoSuchMethodException(
String.format("Unable to find processTemplate method in hierarchy %s", o.toString()));
}

@GET
@Path("{path:^(200|fonts|images|main|site).*}")
public Response staticResources(@PathParam("path") final String path) throws IOException {
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
<java.version>21</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<main.java.package>io.phasetwo.wizard</main.java.package>
<keycloak.version>25.0.0</keycloak.version>
<keycloak.version>26.0.2</keycloak.version>
<guava.version>33.0.0-jre</guava.version>
<lombok.version>1.18.32</lombok.version>
<lombok.version>1.18.34</lombok.version>
<auto-service.version>1.1.1</auto-service.version>
<ossrh.url>https://s01.oss.sonatype.org</ossrh.url>
</properties>
Expand Down

0 comments on commit fc3cc3e

Please sign in to comment.