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

fixes #248 update JwtVerifyHandler to support config reload #249

Merged
merged 1 commit into from
Nov 19, 2022
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,14 @@ public class JwtVerifyHandler implements MiddlewareHandler, IJwtVerifyHandler {
// make this static variable public so that it can be accessed from the server-info module
public static JwtVerifier jwtVerifier;


String basePath;

static {
config = SecurityConfig.load(OPENAPI_SECURITY_CONFIG);
}

private volatile HttpHandler next;

public JwtVerifyHandler() {
// at this moment, we assume that the OpenApiHandler is fully loaded with a single spec or multiple specs.
// And the basePath is the correct one from the OpenApiHandler helper or helperMap if multiple is used.
config = SecurityConfig.load(OPENAPI_SECURITY_CONFIG);
jwtVerifier = new JwtVerifier(config);
}

Expand Down Expand Up @@ -439,6 +435,8 @@ public void register() {
@Override
public void reload() {
config.reload(OPENAPI_SECURITY_CONFIG);
jwtVerifier = new JwtVerifier(config);
ModuleRegistry.registerModule(JwtVerifyHandler.class.getName(), Config.getInstance().getJsonMapConfigNoCache(OPENAPI_SECURITY_CONFIG), null);
}

@Override
Expand Down