Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions jacoco/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies {
jacocoAggregation(project(":plugins:kserve"))
// jacocoAggregation(project(":plugins:management-console"))
jacocoAggregation(project(":plugins:plugin-management-plugin"))
jacocoAggregation(project(":plugins:secure-mode"))
jacocoAggregation(project(":plugins:static-file-plugin"))
jacocoAggregation(project(":prometheus"))
jacocoAggregation(project(":serving"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,21 @@
*/
package ai.djl.serving.plugins.securemode;

import ai.djl.Device;
import ai.djl.ModelException;
import ai.djl.serving.http.IllegalConfigurationException;
import ai.djl.serving.wlm.ModelInfo;
import ai.djl.serving.wlm.util.ModelServerListenerAdapter;

import java.io.IOException;
import java.net.URISyntaxException;

class SecureModeModelServerListener extends ModelServerListenerAdapter {

/** {@inheritDoc} */
@Override
public void onModelLoading(ModelInfo<?, ?> model, Device device) {
super.onModelLoading(model, device);

if (SecureModeUtils.isSecureMode()) {
try {
SecureModeUtils.validateSecurity();
SecureModeUtils.reconcileSources(model.getModelUrl());
} catch (ModelException e) {
throw new IllegalConfigurationException("Secure Mode check failed", e);
} catch (IOException | URISyntaxException e) {
throw new IllegalConfigurationException(
"Error while running Secure Mode checks", e);
}
public void onModelConfigured(ModelInfo<?, ?> model) {
try {
SecureModeUtils.validateSecurity(model);
} catch (IOException e) {
throw new IllegalConfigurationException("Error while running Secure Mode checks", e);
}
}
}
Loading