File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
src/main/java/edu/harvard/iq/dataverse/api Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 33import edu .harvard .iq .dataverse .authorization .groups .impl .ipaddress .ip .IpAddress ;
44import edu .harvard .iq .dataverse .engine .command .DataverseRequest ;
55import edu .harvard .iq .dataverse .settings .SettingsServiceBean ;
6+ import edu .harvard .iq .dataverse .validation .PasswordValidatorServiceBean ;
7+ import jakarta .annotation .PostConstruct ;
68import jakarta .inject .Inject ;
79import jakarta .json .Json ;
810import jakarta .json .JsonObject ;
@@ -49,9 +51,12 @@ public class ApiBlockingFilter implements ContainerRequestFilter {
4951 @ Inject
5052 private SettingsServiceBean settingsService ;
5153
54+ @ Inject
55+ private PasswordValidatorServiceBean passwordValidatorService ;
56+
5257 @ Context
5358 private ResourceInfo resourceInfo ;
54-
59+
5560 @ Context
5661 private HttpServletRequest httpServletRequest ;
5762
@@ -63,6 +68,17 @@ public class ApiBlockingFilter implements ContainerRequestFilter {
6368
6469 private List <Pattern > blockedApiEndpointPatterns = new ArrayList <>();
6570
71+ @ PostConstruct
72+ public void init () {
73+ String policy = settingsService .getValueForKey (SettingsServiceBean .Key .BlockedApiPolicy , "drop" );
74+ if (UNBLOCK_KEY .equals (policy )) {
75+ String key = settingsService .getValueForKey (SettingsServiceBean .Key .BlockedApiKey );
76+ if (passwordValidatorService .validate (key ).size () == 0 ) {
77+ logger .warning ("Weak unblock key detected. Please use a stronger key for better security." );
78+ }
79+ }
80+ }
81+
6682 @ Override
6783 public void filter (ContainerRequestContext requestContext ) throws IOException {
6884
You can’t perform that action at this time.
0 commit comments