Document and validate web-api constructs
[aaa.git] / aaa-shiro / impl / src / main / java / org / opendaylight / aaa / shiro / web / env / ShiroWebContextSecurer.java
index 3e0cf68b215e7a262ab56a021b1bea6a2b5a9085..7e8f14bd9e316f14d1c99f65fdbd19c61d68ef61 100644 (file)
@@ -9,11 +9,11 @@ package org.opendaylight.aaa.shiro.web.env;
 
 import static java.util.Objects.requireNonNull;
 
+import java.util.Arrays;
 import org.apache.shiro.web.env.WebEnvironment;
 import org.opendaylight.aaa.shiro.filters.AAAShiroFilter;
 import org.opendaylight.aaa.web.FilterDetails;
 import org.opendaylight.aaa.web.WebContext;
-import org.opendaylight.aaa.web.WebContextBuilder;
 import org.opendaylight.aaa.web.WebContextSecurer;
 
 /**
@@ -29,14 +29,14 @@ public class ShiroWebContextSecurer implements WebContextSecurer {
     }
 
     @Override
-    public void requireAuthentication(final WebContextBuilder webContextBuilder, final boolean asyncSupported,
+    public void requireAuthentication(final WebContext.Builder webContextBuilder, final boolean asyncSupported,
             final String... urlPatterns) {
-        webContextBuilder
-            // AAA filter in front of these REST web services as well as for moon endpoints
-            .addFilter(FilterDetails.builder()
-                .filter(new AAAShiroFilter(webEnvironment))
-                .addUrlPatterns(urlPatterns)
-                .asyncSupported(asyncSupported)
-                .build());
+        // AAA filter in front of these REST web services as well as for moon endpoints
+        final var filterBuilder = FilterDetails.builder()
+            .filter(new AAAShiroFilter(webEnvironment))
+            .asyncSupported(asyncSupported);
+        Arrays.stream(urlPatterns).forEach(filterBuilder::addUrlPattern);
+
+        webContextBuilder.addFilter(filterBuilder.build());
     }
 }