Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update WireMock to version 3.6.0 to allow use of the start() method #2

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ repositories {

ext {
versions = [
wiremock : "3.5.2",
wiremock : "3.6.0",
jwt : '4.4.0',
jose4j : '0.9.6',
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ public class JwtExtensionFactory implements ExtensionFactory {
public List<Extension> create(WireMockServices services) {
final Admin admin = services.getAdmin();
final JwtSigningKeySettings jwtSigningKeySettings = new JwtSigningKeySettings(admin);
final JwtInitialiser jwtInitialiser = new JwtInitialiser(jwtSigningKeySettings);

return List.of(
jwtSigningKeySettings,
jwtInitialiser,
new JwtHelpersExtension(jwtSigningKeySettings)
);
}
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/org/wiremock/extension/jwt/JwtHelpersExtension.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
public class JwtHelpersExtension implements TemplateHelperProviderExtension {

private final JwtSigningKeySettings jwtSigningKeySettings;
private boolean initialised = false;

public JwtHelpersExtension(JwtSigningKeySettings jwtSigningKeySettings) {
this.jwtSigningKeySettings = jwtSigningKeySettings;
Expand All @@ -22,7 +23,23 @@ public Map<String, Helper<?>> provideTemplateHelpers() {
"jwks", jwksHandlebarsHelper
);
}

@Override
public void start() {
initialise();
}

private void initialise() {
if (!initialised) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking we probably don't need all of this now, given start only happens once during wiremock initialisation

synchronized (this) {
if (!initialised) {
jwtSigningKeySettings.initialise();
initialised = true;
}
}
}
}

@Override
public String getName() {
return "jwt-template-helpers";
Expand Down
36 changes: 0 additions & 36 deletions src/main/java/org/wiremock/extension/jwt/JwtInitialiser.java

This file was deleted.

Loading