Merge pull request #33251 from vpavic

* gh-33251:
  Polish "Polish SecurityProperties"
  Polish SecurityProperties

Closes gh-33251
pull/33270/head
Andy Wilkinson 2 years ago
commit 22b054dc1d

@ -17,8 +17,7 @@
package org.springframework.boot.autoconfigure.security; package org.springframework.boot.autoconfigure.security;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.EnumSet;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@ -83,8 +82,7 @@ public class SecurityProperties {
/** /**
* Security filter chain dispatcher types. * Security filter chain dispatcher types.
*/ */
private Set<DispatcherType> dispatcherTypes = new HashSet<>(Arrays.asList(DispatcherType.ASYNC, private Set<DispatcherType> dispatcherTypes = EnumSet.allOf(DispatcherType.class);
DispatcherType.ERROR, DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.INCLUDE));
public int getOrder() { public int getOrder() {
return this.order; return this.order;

@ -17,6 +17,7 @@
package org.springframework.boot.autoconfigure.security.servlet; package org.springframework.boot.autoconfigure.security.servlet;
import java.security.interfaces.RSAPublicKey; import java.security.interfaces.RSAPublicKey;
import java.util.EnumSet;
import jakarta.servlet.DispatcherType; import jakarta.servlet.DispatcherType;
import org.assertj.core.api.InstanceOfAssertFactories; import org.assertj.core.api.InstanceOfAssertFactories;
@ -161,8 +162,7 @@ class SecurityAutoConfigurationTests {
DelegatingFilterProxyRegistrationBean.class); DelegatingFilterProxyRegistrationBean.class);
assertThat(bean) assertThat(bean)
.extracting("dispatcherTypes", InstanceOfAssertFactories.iterable(DispatcherType.class)) .extracting("dispatcherTypes", InstanceOfAssertFactories.iterable(DispatcherType.class))
.containsOnly(DispatcherType.ASYNC, DispatcherType.ERROR, DispatcherType.REQUEST, .containsExactlyInAnyOrderElementsOf(EnumSet.allOf(DispatcherType.class));
DispatcherType.INCLUDE, DispatcherType.FORWARD);
}); });
} }

Loading…
Cancel
Save