Remove redundant throws clauses
Removes exceptions that are declared in a method's signature but never thrown by the method itself or its implementations/derivatives.
This commit is contained in:
parent
f0515a021c
commit
34dd5fea30
|
@ -74,7 +74,7 @@ class AclClassIdUtils {
|
|||
return identifier;
|
||||
}
|
||||
|
||||
private boolean hasValidClassIdType(ResultSet resultSet) throws SQLException {
|
||||
private boolean hasValidClassIdType(ResultSet resultSet) {
|
||||
boolean hasClassIdType = false;
|
||||
try {
|
||||
hasClassIdType = classIdTypeFrom(resultSet) != null;
|
||||
|
|
|
@ -32,7 +32,7 @@ public class AclFormattingUtilsTests {
|
|||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
@Test
|
||||
public final void testDemergePatternsParametersConstraints() throws Exception {
|
||||
public final void testDemergePatternsParametersConstraints() {
|
||||
try {
|
||||
AclFormattingUtils.demergePatterns(null, "SOME STRING");
|
||||
fail("It should have thrown IllegalArgumentException");
|
||||
|
@ -63,7 +63,7 @@ public class AclFormattingUtilsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public final void testDemergePatterns() throws Exception {
|
||||
public final void testDemergePatterns() {
|
||||
String original = "...........................A...R";
|
||||
String removeBits = "...............................R";
|
||||
assertThat(AclFormattingUtils.demergePatterns(original, removeBits)).isEqualTo(
|
||||
|
@ -76,7 +76,7 @@ public class AclFormattingUtilsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public final void testMergePatternsParametersConstraints() throws Exception {
|
||||
public final void testMergePatternsParametersConstraints() {
|
||||
try {
|
||||
AclFormattingUtils.mergePatterns(null, "SOME STRING");
|
||||
fail("It should have thrown IllegalArgumentException");
|
||||
|
@ -106,7 +106,7 @@ public class AclFormattingUtilsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public final void testMergePatterns() throws Exception {
|
||||
public final void testMergePatterns() {
|
||||
String original = "...............................R";
|
||||
String extraBits = "...........................A....";
|
||||
assertThat(AclFormattingUtils.mergePatterns(original, extraBits)).isEqualTo(
|
||||
|
@ -119,7 +119,7 @@ public class AclFormattingUtilsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public final void testBinaryPrints() throws Exception {
|
||||
public final void testBinaryPrints() {
|
||||
assertThat(AclFormattingUtils.printBinary(15)).isEqualTo(
|
||||
"............................****");
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import java.util.List;
|
|||
public class AclPermissionCacheOptimizerTests {
|
||||
|
||||
@Test
|
||||
public void eagerlyLoadsRequiredAcls() throws Exception {
|
||||
public void eagerlyLoadsRequiredAcls() {
|
||||
AclService service = mock(AclService.class);
|
||||
AclPermissionCacheOptimizer pco = new AclPermissionCacheOptimizer(service);
|
||||
ObjectIdentityRetrievalStrategy oidStrat = mock(ObjectIdentityRetrievalStrategy.class);
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.springframework.security.core.Authentication;
|
|||
public class AclPermissionEvaluatorTests {
|
||||
|
||||
@Test
|
||||
public void hasPermissionReturnsTrueIfAclGrantsPermission() throws Exception {
|
||||
public void hasPermissionReturnsTrueIfAclGrantsPermission() {
|
||||
AclService service = mock(AclService.class);
|
||||
AclPermissionEvaluator pe = new AclPermissionEvaluator(service);
|
||||
ObjectIdentity oid = mock(ObjectIdentity.class);
|
||||
|
|
|
@ -37,7 +37,7 @@ import java.util.List;
|
|||
@SuppressWarnings({ "unchecked" })
|
||||
public class AclEntryAfterInvocationCollectionFilteringProviderTests {
|
||||
@Test
|
||||
public void objectsAreRemovedIfPermissionDenied() throws Exception {
|
||||
public void objectsAreRemovedIfPermissionDenied() {
|
||||
AclService service = mock(AclService.class);
|
||||
Acl acl = mock(Acl.class);
|
||||
when(acl.isGranted(any(), any(), anyBoolean())).thenReturn(
|
||||
|
@ -63,7 +63,7 @@ public class AclEntryAfterInvocationCollectionFilteringProviderTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void accessIsGrantedIfNoAttributesDefined() throws Exception {
|
||||
public void accessIsGrantedIfNoAttributesDefined() {
|
||||
AclEntryAfterInvocationCollectionFilteringProvider provider = new AclEntryAfterInvocationCollectionFilteringProvider(
|
||||
mock(AclService.class), Arrays.asList(mock(Permission.class)));
|
||||
Object returned = new Object();
|
||||
|
@ -75,7 +75,7 @@ public class AclEntryAfterInvocationCollectionFilteringProviderTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void nullReturnObjectIsIgnored() throws Exception {
|
||||
public void nullReturnObjectIsIgnored() {
|
||||
AclService service = mock(AclService.class);
|
||||
AclEntryAfterInvocationCollectionFilteringProvider provider = new AclEntryAfterInvocationCollectionFilteringProvider(
|
||||
service, Arrays.asList(mock(Permission.class)));
|
||||
|
|
|
@ -37,7 +37,7 @@ import java.util.List;
|
|||
public class AclEntryAfterInvocationProviderTests {
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void rejectsMissingPermissions() throws Exception {
|
||||
public void rejectsMissingPermissions() {
|
||||
try {
|
||||
new AclEntryAfterInvocationProvider(mock(AclService.class), null);
|
||||
fail("Exception expected");
|
||||
|
@ -72,7 +72,7 @@ public class AclEntryAfterInvocationProviderTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void accessIsGrantedIfNoAttributesDefined() throws Exception {
|
||||
public void accessIsGrantedIfNoAttributesDefined() {
|
||||
AclEntryAfterInvocationProvider provider = new AclEntryAfterInvocationProvider(
|
||||
mock(AclService.class), Arrays.asList(mock(Permission.class)));
|
||||
Object returned = new Object();
|
||||
|
@ -85,7 +85,7 @@ public class AclEntryAfterInvocationProviderTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void accessIsGrantedIfObjectTypeNotSupported() throws Exception {
|
||||
public void accessIsGrantedIfObjectTypeNotSupported() {
|
||||
AclEntryAfterInvocationProvider provider = new AclEntryAfterInvocationProvider(
|
||||
mock(AclService.class), Arrays.asList(mock(Permission.class)));
|
||||
provider.setProcessDomainObjectClass(String.class);
|
||||
|
@ -131,7 +131,7 @@ public class AclEntryAfterInvocationProviderTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void nullReturnObjectIsIgnored() throws Exception {
|
||||
public void nullReturnObjectIsIgnored() {
|
||||
AclService service = mock(AclService.class);
|
||||
AclEntryAfterInvocationProvider provider = new AclEntryAfterInvocationProvider(
|
||||
service, Arrays.asList(mock(Permission.class)));
|
||||
|
|
|
@ -54,7 +54,7 @@ public class AclImplTests {
|
|||
// ========================================================================================================
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
SecurityContextHolder.getContext().setAuthentication(auth);
|
||||
authzStrategy = mock(AclAuthorizationStrategy.class);
|
||||
mockAuditLogger = mock(AuditLogger.class);
|
||||
|
@ -63,12 +63,12 @@ public class AclImplTests {
|
|||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
public void tearDown() {
|
||||
SecurityContextHolder.clearContext();
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void constructorsRejectNullObjectIdentity() throws Exception {
|
||||
public void constructorsRejectNullObjectIdentity() {
|
||||
try {
|
||||
new AclImpl(null, 1, authzStrategy, pgs, null, null, true, new PrincipalSid(
|
||||
"joe"));
|
||||
|
@ -80,7 +80,7 @@ public class AclImplTests {
|
|||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void constructorsRejectNullId() throws Exception {
|
||||
public void constructorsRejectNullId() {
|
||||
try {
|
||||
new AclImpl(objectIdentity, null, authzStrategy, pgs, null, null, true,
|
||||
new PrincipalSid("joe"));
|
||||
|
@ -93,7 +93,7 @@ public class AclImplTests {
|
|||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void constructorsRejectNullAclAuthzStrategy() throws Exception {
|
||||
public void constructorsRejectNullAclAuthzStrategy() {
|
||||
try {
|
||||
new AclImpl(objectIdentity, 1, null, new DefaultPermissionGrantingStrategy(
|
||||
mockAuditLogger), null, null, true, new PrincipalSid("joe"));
|
||||
|
@ -105,7 +105,7 @@ public class AclImplTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void insertAceRejectsNullParameters() throws Exception {
|
||||
public void insertAceRejectsNullParameters() {
|
||||
MutableAcl acl = new AclImpl(objectIdentity, 1, authzStrategy, pgs, null, null,
|
||||
true, new PrincipalSid("joe"));
|
||||
try {
|
||||
|
@ -123,7 +123,7 @@ public class AclImplTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void insertAceAddsElementAtCorrectIndex() throws Exception {
|
||||
public void insertAceAddsElementAtCorrectIndex() {
|
||||
MutableAcl acl = new AclImpl(objectIdentity, 1, authzStrategy, pgs, null, null,
|
||||
true, new PrincipalSid("joe"));
|
||||
MockAclService service = new MockAclService();
|
||||
|
@ -166,7 +166,7 @@ public class AclImplTests {
|
|||
}
|
||||
|
||||
@Test(expected = NotFoundException.class)
|
||||
public void insertAceFailsForNonExistentElement() throws Exception {
|
||||
public void insertAceFailsForNonExistentElement() {
|
||||
MutableAcl acl = new AclImpl(objectIdentity, 1, authzStrategy, pgs, null, null,
|
||||
true, new PrincipalSid("joe"));
|
||||
MockAclService service = new MockAclService();
|
||||
|
@ -180,7 +180,7 @@ public class AclImplTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void deleteAceKeepsInitialOrdering() throws Exception {
|
||||
public void deleteAceKeepsInitialOrdering() {
|
||||
MutableAcl acl = new AclImpl(objectIdentity, 1, authzStrategy, pgs, null, null,
|
||||
true, new PrincipalSid("joe"));
|
||||
MockAclService service = new MockAclService();
|
||||
|
@ -217,7 +217,7 @@ public class AclImplTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void deleteAceFailsForNonExistentElement() throws Exception {
|
||||
public void deleteAceFailsForNonExistentElement() {
|
||||
AclAuthorizationStrategyImpl strategy = new AclAuthorizationStrategyImpl(
|
||||
new SimpleGrantedAuthority("ROLE_OWNERSHIP"), new SimpleGrantedAuthority(
|
||||
"ROLE_AUDITING"), new SimpleGrantedAuthority("ROLE_GENERAL"));
|
||||
|
@ -232,7 +232,7 @@ public class AclImplTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void isGrantingRejectsEmptyParameters() throws Exception {
|
||||
public void isGrantingRejectsEmptyParameters() {
|
||||
MutableAcl acl = new AclImpl(objectIdentity, 1, authzStrategy, pgs, null, null,
|
||||
true, new PrincipalSid("joe"));
|
||||
Sid ben = new PrincipalSid("ben");
|
||||
|
@ -251,7 +251,7 @@ public class AclImplTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void isGrantingGrantsAccessForAclWithNoParent() throws Exception {
|
||||
public void isGrantingGrantsAccessForAclWithNoParent() {
|
||||
Authentication auth = new TestingAuthenticationToken("ben", "ignored",
|
||||
"ROLE_GENERAL", "ROLE_GUEST");
|
||||
auth.setAuthenticated(true);
|
||||
|
@ -297,7 +297,7 @@ public class AclImplTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void isGrantingGrantsAccessForInheritableAcls() throws Exception {
|
||||
public void isGrantingGrantsAccessForInheritableAcls() {
|
||||
Authentication auth = new TestingAuthenticationToken("ben", "ignored",
|
||||
"ROLE_GENERAL");
|
||||
auth.setAuthenticated(true);
|
||||
|
@ -379,7 +379,7 @@ public class AclImplTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void updatedAceValuesAreCorrectlyReflectedInAcl() throws Exception {
|
||||
public void updatedAceValuesAreCorrectlyReflectedInAcl() {
|
||||
Authentication auth = new TestingAuthenticationToken("ben", "ignored",
|
||||
"ROLE_GENERAL");
|
||||
auth.setAuthenticated(true);
|
||||
|
@ -411,7 +411,7 @@ public class AclImplTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void auditableEntryFlagsAreUpdatedCorrectly() throws Exception {
|
||||
public void auditableEntryFlagsAreUpdatedCorrectly() {
|
||||
Authentication auth = new TestingAuthenticationToken("ben", "ignored",
|
||||
"ROLE_AUDITING", "ROLE_GENERAL");
|
||||
auth.setAuthenticated(true);
|
||||
|
@ -449,7 +449,7 @@ public class AclImplTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void gettersAndSettersAreConsistent() throws Exception {
|
||||
public void gettersAndSettersAreConsistent() {
|
||||
Authentication auth = new TestingAuthenticationToken("ben", "ignored",
|
||||
"ROLE_GENERAL");
|
||||
auth.setAuthenticated(true);
|
||||
|
@ -485,7 +485,7 @@ public class AclImplTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void isSidLoadedBehavesAsExpected() throws Exception {
|
||||
public void isSidLoadedBehavesAsExpected() {
|
||||
List<Sid> loadedSids = Arrays.asList(new PrincipalSid("ben"),
|
||||
new GrantedAuthoritySid("ROLE_IGNORED"));
|
||||
MutableAcl acl = new AclImpl(objectIdentity, 1, authzStrategy, pgs, null,
|
||||
|
@ -513,22 +513,21 @@ public class AclImplTests {
|
|||
}
|
||||
|
||||
@Test(expected = NotFoundException.class)
|
||||
public void insertAceRaisesNotFoundExceptionForIndexLessThanZero() throws Exception {
|
||||
public void insertAceRaisesNotFoundExceptionForIndexLessThanZero() {
|
||||
AclImpl acl = new AclImpl(objectIdentity, 1, authzStrategy, pgs, null, null,
|
||||
true, new PrincipalSid("joe"));
|
||||
acl.insertAce(-1, mock(Permission.class), mock(Sid.class), true);
|
||||
}
|
||||
|
||||
@Test(expected = NotFoundException.class)
|
||||
public void deleteAceRaisesNotFoundExceptionForIndexLessThanZero() throws Exception {
|
||||
public void deleteAceRaisesNotFoundExceptionForIndexLessThanZero() {
|
||||
AclImpl acl = new AclImpl(objectIdentity, 1, authzStrategy, pgs, null, null,
|
||||
true, new PrincipalSid("joe"));
|
||||
acl.deleteAce(-1);
|
||||
}
|
||||
|
||||
@Test(expected = NotFoundException.class)
|
||||
public void insertAceRaisesNotFoundExceptionForIndexGreaterThanSize()
|
||||
throws Exception {
|
||||
public void insertAceRaisesNotFoundExceptionForIndexGreaterThanSize() {
|
||||
AclImpl acl = new AclImpl(objectIdentity, 1, authzStrategy, pgs, null, null,
|
||||
true, new PrincipalSid("joe"));
|
||||
// Insert at zero, OK.
|
||||
|
@ -539,7 +538,7 @@ public class AclImplTests {
|
|||
|
||||
// SEC-1151
|
||||
@Test(expected = NotFoundException.class)
|
||||
public void deleteAceRaisesNotFoundExceptionForIndexEqualToSize() throws Exception {
|
||||
public void deleteAceRaisesNotFoundExceptionForIndexEqualToSize() {
|
||||
AclImpl acl = new AclImpl(objectIdentity, 1, authzStrategy, pgs, null, null,
|
||||
true, new PrincipalSid("joe"));
|
||||
acl.insertAce(0, mock(Permission.class), mock(Sid.class), true);
|
||||
|
@ -549,7 +548,7 @@ public class AclImplTests {
|
|||
|
||||
// SEC-1795
|
||||
@Test
|
||||
public void changingParentIsSuccessful() throws Exception {
|
||||
public void changingParentIsSuccessful() {
|
||||
AclImpl parentAcl = new AclImpl(objectIdentity, 1L, authzStrategy,
|
||||
mockAuditLogger);
|
||||
AclImpl childAcl = new AclImpl(objectIdentity, 2L, authzStrategy, mockAuditLogger);
|
||||
|
|
|
@ -41,17 +41,17 @@ public class AclImplementationSecurityCheckTests {
|
|||
// ========================================================================================================
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
SecurityContextHolder.clearContext();
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
public void tearDown() {
|
||||
SecurityContextHolder.clearContext();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSecurityCheckNoACEs() throws Exception {
|
||||
public void testSecurityCheckNoACEs() {
|
||||
Authentication auth = new TestingAuthenticationToken("user", "password",
|
||||
"ROLE_GENERAL", "ROLE_AUDITING", "ROLE_OWNERSHIP");
|
||||
auth.setAuthenticated(true);
|
||||
|
@ -103,7 +103,7 @@ public class AclImplementationSecurityCheckTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSecurityCheckWithMultipleACEs() throws Exception {
|
||||
public void testSecurityCheckWithMultipleACEs() {
|
||||
// Create a simple authentication with ROLE_GENERAL
|
||||
Authentication auth = new TestingAuthenticationToken("user", "password",
|
||||
"ROLE_GENERAL");
|
||||
|
@ -206,7 +206,7 @@ public class AclImplementationSecurityCheckTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSecurityCheckWithInheritableACEs() throws Exception {
|
||||
public void testSecurityCheckWithInheritableACEs() {
|
||||
// Create a simple authentication with ROLE_GENERAL
|
||||
Authentication auth = new TestingAuthenticationToken("user", "password",
|
||||
"ROLE_GENERAL");
|
||||
|
@ -273,7 +273,7 @@ public class AclImplementationSecurityCheckTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSecurityCheckPrincipalOwner() throws Exception {
|
||||
public void testSecurityCheckPrincipalOwner() {
|
||||
Authentication auth = new TestingAuthenticationToken("user", "password",
|
||||
"ROLE_ONE");
|
||||
auth.setAuthenticated(true);
|
||||
|
|
|
@ -44,7 +44,7 @@ public class AuditLoggerTests {
|
|||
// ========================================================================================================
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
logger = new ConsoleAuditLogger();
|
||||
ace = mock(AuditableAccessControlEntry.class);
|
||||
console = System.out;
|
||||
|
@ -52,7 +52,7 @@ public class AuditLoggerTests {
|
|||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
public void tearDown() {
|
||||
System.setOut(console);
|
||||
bytes.reset();
|
||||
}
|
||||
|
@ -65,14 +65,14 @@ public class AuditLoggerTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void successIsNotLoggedIfAceDoesntRequireSuccessAudit() throws Exception {
|
||||
public void successIsNotLoggedIfAceDoesntRequireSuccessAudit() {
|
||||
when(ace.isAuditSuccess()).thenReturn(false);
|
||||
logger.logIfNeeded(true, ace);
|
||||
assertThat(bytes.size()).isZero();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void successIsLoggedIfAceRequiresSuccessAudit() throws Exception {
|
||||
public void successIsLoggedIfAceRequiresSuccessAudit() {
|
||||
when(ace.isAuditSuccess()).thenReturn(true);
|
||||
|
||||
logger.logIfNeeded(true, ace);
|
||||
|
@ -80,14 +80,14 @@ public class AuditLoggerTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void failureIsntLoggedIfAceDoesntRequireFailureAudit() throws Exception {
|
||||
public void failureIsntLoggedIfAceDoesntRequireFailureAudit() {
|
||||
when(ace.isAuditFailure()).thenReturn(false);
|
||||
logger.logIfNeeded(false, ace);
|
||||
assertThat(bytes.size()).isZero();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void failureIsLoggedIfAceRequiresFailureAudit() throws Exception {
|
||||
public void failureIsLoggedIfAceRequiresFailureAudit() {
|
||||
when(ace.isAuditFailure()).thenReturn(true);
|
||||
logger.logIfNeeded(false, ace);
|
||||
assertThat(bytes.toString()).startsWith("DENIED due to ACE");
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ObjectIdentityImplTests {
|
|||
// ========================================================================================================
|
||||
|
||||
@Test
|
||||
public void constructorsRespectRequiredFields() throws Exception {
|
||||
public void constructorsRespectRequiredFields() {
|
||||
// Check one-argument constructor required field
|
||||
try {
|
||||
new ObjectIdentityImpl(null);
|
||||
|
@ -79,14 +79,14 @@ public class ObjectIdentityImplTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void gettersReturnExpectedValues() throws Exception {
|
||||
public void gettersReturnExpectedValues() {
|
||||
ObjectIdentity obj = new ObjectIdentityImpl(DOMAIN_CLASS, 1L);
|
||||
assertThat(obj.getIdentifier()).isEqualTo(1L);
|
||||
assertThat(obj.getType()).isEqualTo(MockIdDomainObject.class.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetIdMethodConstraints() throws Exception {
|
||||
public void testGetIdMethodConstraints() {
|
||||
// Check the getId() method is present
|
||||
try {
|
||||
new ObjectIdentityImpl("A_STRING_OBJECT");
|
||||
|
@ -125,12 +125,12 @@ public class ObjectIdentityImplTests {
|
|||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void constructorRejectsInvalidTypeParameter() throws Exception {
|
||||
public void constructorRejectsInvalidTypeParameter() {
|
||||
new ObjectIdentityImpl("", 1L);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEquals() throws Exception {
|
||||
public void testEquals() {
|
||||
ObjectIdentity obj = new ObjectIdentityImpl(DOMAIN_CLASS, 1L);
|
||||
MockIdDomainObject mockObj = new MockIdDomainObject();
|
||||
mockObj.setId(1L);
|
||||
|
@ -148,7 +148,7 @@ public class ObjectIdentityImplTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void hashcodeIsDifferentForDifferentJavaTypes() throws Exception {
|
||||
public void hashcodeIsDifferentForDifferentJavaTypes() {
|
||||
ObjectIdentity obj = new ObjectIdentityImpl(Object.class, 1L);
|
||||
ObjectIdentity obj2 = new ObjectIdentityImpl(String.class, 1L);
|
||||
assertThat(obj.hashCode()).isNotEqualTo(obj2.hashCode());
|
||||
|
@ -164,7 +164,7 @@ public class ObjectIdentityImplTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void equalStringIdsAreEqualAndHaveSameHashcode() throws Exception {
|
||||
public void equalStringIdsAreEqualAndHaveSameHashcode() {
|
||||
ObjectIdentity obj = new ObjectIdentityImpl(Object.class, "1000");
|
||||
ObjectIdentity obj2 = new ObjectIdentityImpl(Object.class, "1000");
|
||||
assertThat(obj2).isEqualTo(obj);
|
||||
|
@ -172,7 +172,7 @@ public class ObjectIdentityImplTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void stringAndNumericIdsAreNotEqual() throws Exception {
|
||||
public void stringAndNumericIdsAreNotEqual() {
|
||||
ObjectIdentity obj = new ObjectIdentityImpl(Object.class, "1000");
|
||||
ObjectIdentity obj2 = new ObjectIdentityImpl(Object.class, 1000L);
|
||||
assertThat(obj).isNotEqualTo(obj2);
|
||||
|
|
|
@ -31,7 +31,7 @@ public class ObjectIdentityRetrievalStrategyImplTests {
|
|||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
@Test
|
||||
public void testObjectIdentityCreation() throws Exception {
|
||||
public void testObjectIdentityCreation() {
|
||||
MockIdDomainObject domain = new MockIdDomainObject();
|
||||
domain.setId(1);
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ public abstract class AbstractBasicLookupStrategyTests {
|
|||
}
|
||||
|
||||
private void checkEntries(ObjectIdentity topParentOid, ObjectIdentity middleParentOid, ObjectIdentity childOid,
|
||||
Map<ObjectIdentity, Acl> map) throws Exception {
|
||||
Map<ObjectIdentity, Acl> map) {
|
||||
assertThat(map).hasSize(3);
|
||||
|
||||
MutableAcl topParent = (MutableAcl) map.get(topParentOid);
|
||||
|
@ -238,7 +238,7 @@ public abstract class AbstractBasicLookupStrategyTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAllParentsAreRetrievedWhenChildIsLoaded() throws Exception {
|
||||
public void testAllParentsAreRetrievedWhenChildIsLoaded() {
|
||||
String query = "INSERT INTO acl_object_identity(ID,OBJECT_ID_CLASS,OBJECT_ID_IDENTITY,PARENT_OBJECT,OWNER_SID,ENTRIES_INHERITING) VALUES (6,2,103,1,1,1);";
|
||||
getJdbcTemplate().execute(query);
|
||||
|
||||
|
@ -266,7 +266,7 @@ public abstract class AbstractBasicLookupStrategyTests {
|
|||
* Test created from SEC-590.
|
||||
*/
|
||||
@Test
|
||||
public void testReadAllObjectIdentitiesWhenLastElementIsAlreadyCached() throws Exception {
|
||||
public void testReadAllObjectIdentitiesWhenLastElementIsAlreadyCached() {
|
||||
String query = "INSERT INTO acl_object_identity(ID,OBJECT_ID_CLASS,OBJECT_ID_IDENTITY,PARENT_OBJECT,OWNER_SID,ENTRIES_INHERITING) VALUES (6,2,105,null,1,1);"
|
||||
+ "INSERT INTO acl_object_identity(ID,OBJECT_ID_CLASS,OBJECT_ID_IDENTITY,PARENT_OBJECT,OWNER_SID,ENTRIES_INHERITING) VALUES (7,2,106,6,1,1);"
|
||||
+ "INSERT INTO acl_object_identity(ID,OBJECT_ID_CLASS,OBJECT_ID_IDENTITY,PARENT_OBJECT,OWNER_SID,ENTRIES_INHERITING) VALUES (8,2,107,6,1,1);"
|
||||
|
|
|
@ -151,13 +151,13 @@ public class AclClassIdUtilsTest {
|
|||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void shouldNotAcceptNullConversionServiceInConstruction() throws SQLException {
|
||||
public void shouldNotAcceptNullConversionServiceInConstruction() {
|
||||
// when
|
||||
new AclClassIdUtils(null);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void shouldNotAcceptNullConversionServiceInSetter() throws SQLException {
|
||||
public void shouldNotAcceptNullConversionServiceInSetter() {
|
||||
// when
|
||||
aclClassIdUtils.setConversionService(null);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class BasicLookupStrategyTests extends AbstractBasicLookupStrategyTests {
|
|||
}
|
||||
|
||||
@AfterClass
|
||||
public static void dropDatabase() throws Exception {
|
||||
public static void dropDatabase() {
|
||||
DATABASE_HELPER.getDataSource().destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ public class BasicLookupStrategyWithAclClassTypeTests extends AbstractBasicLooku
|
|||
}
|
||||
|
||||
@AfterClass
|
||||
public static void dropDatabase() throws Exception {
|
||||
public static void dropDatabase() {
|
||||
DATABASE_HELPER.getDataSource().destroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -86,14 +86,14 @@ public class EhCacheBasedAclCacheTests {
|
|||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void constructorRejectsNullParameters() throws Exception {
|
||||
public void constructorRejectsNullParameters() {
|
||||
new EhCacheBasedAclCache(null, new DefaultPermissionGrantingStrategy(
|
||||
new ConsoleAuditLogger()), new AclAuthorizationStrategyImpl(
|
||||
new SimpleGrantedAuthority("ROLE_USER")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void methodsRejectNullParameters() throws Exception {
|
||||
public void methodsRejectNullParameters() {
|
||||
try {
|
||||
Serializable id = null;
|
||||
myCache.evictFromCache(id);
|
||||
|
@ -162,14 +162,14 @@ public class EhCacheBasedAclCacheTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void clearCache() throws Exception {
|
||||
public void clearCache() {
|
||||
myCache.clearCache();
|
||||
|
||||
verify(cache).removeAll();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void putInCache() throws Exception {
|
||||
public void putInCache() {
|
||||
myCache.putInCache(acl);
|
||||
|
||||
verify(cache, times(2)).put(element.capture());
|
||||
|
@ -181,7 +181,7 @@ public class EhCacheBasedAclCacheTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void putInCacheAclWithParent() throws Exception {
|
||||
public void putInCacheAclWithParent() {
|
||||
Authentication auth = new TestingAuthenticationToken("user", "password",
|
||||
"ROLE_GENERAL");
|
||||
auth.setAuthenticated(true);
|
||||
|
@ -216,14 +216,14 @@ public class EhCacheBasedAclCacheTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void getFromCacheSerializable() throws Exception {
|
||||
public void getFromCacheSerializable() {
|
||||
when(cache.get(acl.getId())).thenReturn(new Element(acl.getId(), acl));
|
||||
|
||||
assertThat(myCache.getFromCache(acl.getId())).isEqualTo(acl);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getFromCacheSerializablePopulatesTransient() throws Exception {
|
||||
public void getFromCacheSerializablePopulatesTransient() {
|
||||
when(cache.get(acl.getId())).thenReturn(new Element(acl.getId(), acl));
|
||||
|
||||
myCache.putInCache(acl);
|
||||
|
@ -240,14 +240,14 @@ public class EhCacheBasedAclCacheTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void getFromCacheObjectIdentity() throws Exception {
|
||||
public void getFromCacheObjectIdentity() {
|
||||
when(cache.get(acl.getId())).thenReturn(new Element(acl.getId(), acl));
|
||||
|
||||
assertThat(myCache.getFromCache(acl.getId())).isEqualTo(acl);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getFromCacheObjectIdentityPopulatesTransient() throws Exception {
|
||||
public void getFromCacheObjectIdentityPopulatesTransient() {
|
||||
when(cache.get(acl.getObjectIdentity()))
|
||||
.thenReturn(new Element(acl.getId(), acl));
|
||||
|
||||
|
@ -265,7 +265,7 @@ public class EhCacheBasedAclCacheTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void evictCacheSerializable() throws Exception {
|
||||
public void evictCacheSerializable() {
|
||||
when(cache.get(acl.getObjectIdentity()))
|
||||
.thenReturn(new Element(acl.getId(), acl));
|
||||
|
||||
|
@ -276,7 +276,7 @@ public class EhCacheBasedAclCacheTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void evictCacheObjectIdentity() throws Exception {
|
||||
public void evictCacheObjectIdentity() {
|
||||
when(cache.get(acl.getId())).thenReturn(new Element(acl.getId(), acl));
|
||||
|
||||
myCache.evictFromCache(acl.getId());
|
||||
|
|
|
@ -132,7 +132,7 @@ public class JdbcMutableAclServiceTests extends
|
|||
}
|
||||
|
||||
@AfterTransaction
|
||||
public void clearContextAndData() throws Exception {
|
||||
public void clearContextAndData() {
|
||||
SecurityContextHolder.clearContext();
|
||||
jdbcTemplate.execute("drop table acl_entry");
|
||||
jdbcTemplate.execute("drop table acl_object_identity");
|
||||
|
@ -285,7 +285,7 @@ public class JdbcMutableAclServiceTests extends
|
|||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void deleteAclAlsoDeletesChildren() throws Exception {
|
||||
public void deleteAclAlsoDeletesChildren() {
|
||||
SecurityContextHolder.getContext().setAuthentication(auth);
|
||||
|
||||
jdbcMutableAclService.createAcl(getTopParentOid());
|
||||
|
@ -323,7 +323,7 @@ public class JdbcMutableAclServiceTests extends
|
|||
}
|
||||
|
||||
@Test
|
||||
public void constructorRejectsNullParameters() throws Exception {
|
||||
public void constructorRejectsNullParameters() {
|
||||
try {
|
||||
new JdbcMutableAclService(null, lookupStrategy, aclCache);
|
||||
fail("It should have thrown IllegalArgumentException");
|
||||
|
@ -347,7 +347,7 @@ public class JdbcMutableAclServiceTests extends
|
|||
}
|
||||
|
||||
@Test
|
||||
public void createAclRejectsNullParameter() throws Exception {
|
||||
public void createAclRejectsNullParameter() {
|
||||
try {
|
||||
jdbcMutableAclService.createAcl(null);
|
||||
fail("It should have thrown IllegalArgumentException");
|
||||
|
@ -358,7 +358,7 @@ public class JdbcMutableAclServiceTests extends
|
|||
|
||||
@Test
|
||||
@Transactional
|
||||
public void createAclForADuplicateDomainObject() throws Exception {
|
||||
public void createAclForADuplicateDomainObject() {
|
||||
SecurityContextHolder.getContext().setAuthentication(auth);
|
||||
ObjectIdentity duplicateOid = new ObjectIdentityImpl(TARGET_CLASS,
|
||||
100L);
|
||||
|
@ -374,7 +374,7 @@ public class JdbcMutableAclServiceTests extends
|
|||
|
||||
@Test
|
||||
@Transactional
|
||||
public void deleteAclRejectsNullParameters() throws Exception {
|
||||
public void deleteAclRejectsNullParameters() {
|
||||
try {
|
||||
jdbcMutableAclService.deleteAcl(null, true);
|
||||
fail("It should have thrown IllegalArgumentException");
|
||||
|
@ -385,7 +385,7 @@ public class JdbcMutableAclServiceTests extends
|
|||
|
||||
@Test
|
||||
@Transactional
|
||||
public void deleteAclWithChildrenThrowsException() throws Exception {
|
||||
public void deleteAclWithChildrenThrowsException() {
|
||||
SecurityContextHolder.getContext().setAuthentication(auth);
|
||||
MutableAcl parent = jdbcMutableAclService.createAcl(getTopParentOid());
|
||||
MutableAcl child = jdbcMutableAclService.createAcl(getMiddleParentOid());
|
||||
|
@ -411,7 +411,7 @@ public class JdbcMutableAclServiceTests extends
|
|||
|
||||
@Test
|
||||
@Transactional
|
||||
public void deleteAclRemovesRowsFromDatabase() throws Exception {
|
||||
public void deleteAclRemovesRowsFromDatabase() {
|
||||
SecurityContextHolder.getContext().setAuthentication(auth);
|
||||
MutableAcl child = jdbcMutableAclService.createAcl(getChildOid());
|
||||
child.insertAce(0, BasePermission.DELETE, new PrincipalSid(auth), false);
|
||||
|
@ -434,7 +434,7 @@ public class JdbcMutableAclServiceTests extends
|
|||
/** SEC-1107 */
|
||||
@Test
|
||||
@Transactional
|
||||
public void identityWithIntegerIdIsSupportedByCreateAcl() throws Exception {
|
||||
public void identityWithIntegerIdIsSupportedByCreateAcl() {
|
||||
SecurityContextHolder.getContext().setAuthentication(auth);
|
||||
ObjectIdentity oid = new ObjectIdentityImpl(TARGET_CLASS, 101);
|
||||
jdbcMutableAclService.createAcl(oid);
|
||||
|
@ -448,7 +448,7 @@ public class JdbcMutableAclServiceTests extends
|
|||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void childrenAreClearedFromCacheWhenParentIsUpdated() throws Exception {
|
||||
public void childrenAreClearedFromCacheWhenParentIsUpdated() {
|
||||
Authentication auth = new TestingAuthenticationToken("ben", "ignored",
|
||||
"ROLE_ADMINISTRATOR");
|
||||
auth.setAuthenticated(true);
|
||||
|
@ -486,7 +486,7 @@ public class JdbcMutableAclServiceTests extends
|
|||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void childrenAreClearedFromCacheWhenParentisUpdated2() throws Exception {
|
||||
public void childrenAreClearedFromCacheWhenParentisUpdated2() {
|
||||
Authentication auth = new TestingAuthenticationToken("system", "secret",
|
||||
"ROLE_IGNORED");
|
||||
SecurityContextHolder.getContext().setAuthentication(auth);
|
||||
|
|
|
@ -70,7 +70,7 @@ public class JdbcMutableAclServiceTestsWithAclClassId extends JdbcMutableAclServ
|
|||
|
||||
@Test
|
||||
@Transactional
|
||||
public void identityWithUuidIdIsSupportedByCreateAcl() throws Exception {
|
||||
public void identityWithUuidIdIsSupportedByCreateAcl() {
|
||||
SecurityContextHolder.getContext().setAuthentication(getAuth());
|
||||
|
||||
UUID id = UUID.randomUUID();
|
||||
|
|
|
@ -65,13 +65,13 @@ public class SpringCacheBasedAclCacheTests {
|
|||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void constructorRejectsNullParameters() throws Exception {
|
||||
public void constructorRejectsNullParameters() {
|
||||
new SpringCacheBasedAclCache(null, null, null);
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Test
|
||||
public void cacheOperationsAclWithoutParent() throws Exception {
|
||||
public void cacheOperationsAclWithoutParent() {
|
||||
Cache cache = getCache();
|
||||
Map realCache = (Map) cache.getNativeCache();
|
||||
ObjectIdentity identity = new ObjectIdentityImpl(TARGET_CLASS, 100L);
|
||||
|
|
|
@ -46,7 +46,7 @@ public class SidRetrievalStrategyTests {
|
|||
// ========================================================================================================
|
||||
|
||||
@Test
|
||||
public void correctSidsAreRetrieved() throws Exception {
|
||||
public void correctSidsAreRetrieved() {
|
||||
SidRetrievalStrategy retrStrategy = new SidRetrievalStrategyImpl();
|
||||
List<Sid> sids = retrStrategy.getSids(authentication);
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class SidRetrievalStrategyTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void roleHierarchyIsUsedWhenSet() throws Exception {
|
||||
public void roleHierarchyIsUsedWhenSet() {
|
||||
RoleHierarchy rh = mock(RoleHierarchy.class);
|
||||
List rhAuthorities = AuthorityUtils.createAuthorityList("D");
|
||||
when(rh.getReachableGrantedAuthorities(anyCollection()))
|
||||
|
|
|
@ -32,7 +32,7 @@ public class SidTests {
|
|||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
@Test
|
||||
public void testPrincipalSidConstructorsRequiredFields() throws Exception {
|
||||
public void testPrincipalSidConstructorsRequiredFields() {
|
||||
// Check one String-argument constructor
|
||||
try {
|
||||
String string = null;
|
||||
|
@ -77,7 +77,7 @@ public class SidTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGrantedAuthoritySidConstructorsRequiredFields() throws Exception {
|
||||
public void testGrantedAuthoritySidConstructorsRequiredFields() {
|
||||
// Check one String-argument constructor
|
||||
try {
|
||||
String string = null;
|
||||
|
@ -134,7 +134,7 @@ public class SidTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testPrincipalSidEquals() throws Exception {
|
||||
public void testPrincipalSidEquals() {
|
||||
Authentication authentication = new TestingAuthenticationToken("johndoe",
|
||||
"password");
|
||||
Sid principalSid = new PrincipalSid(authentication);
|
||||
|
@ -152,7 +152,7 @@ public class SidTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGrantedAuthoritySidEquals() throws Exception {
|
||||
public void testGrantedAuthoritySidEquals() {
|
||||
GrantedAuthority ga = new SimpleGrantedAuthority("ROLE_TEST");
|
||||
Sid gaSid = new GrantedAuthoritySid(ga);
|
||||
|
||||
|
@ -169,7 +169,7 @@ public class SidTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testPrincipalSidHashCode() throws Exception {
|
||||
public void testPrincipalSidHashCode() {
|
||||
Authentication authentication = new TestingAuthenticationToken("johndoe",
|
||||
"password");
|
||||
Sid principalSid = new PrincipalSid(authentication);
|
||||
|
@ -184,7 +184,7 @@ public class SidTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGrantedAuthoritySidHashCode() throws Exception {
|
||||
public void testGrantedAuthoritySidHashCode() {
|
||||
GrantedAuthority ga = new SimpleGrantedAuthority("ROLE_TEST");
|
||||
Sid gaSid = new GrantedAuthoritySid(ga);
|
||||
|
||||
|
@ -198,7 +198,7 @@ public class SidTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetters() throws Exception {
|
||||
public void testGetters() {
|
||||
Authentication authentication = new TestingAuthenticationToken("johndoe",
|
||||
"password");
|
||||
PrincipalSid principalSid = new PrincipalSid(authentication);
|
||||
|
|
|
@ -81,7 +81,7 @@ public aspect AnnotationSecurityAspect implements InitializingBean {
|
|||
this.securityInterceptor = securityInterceptor;
|
||||
}
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
public void afterPropertiesSet() {
|
||||
if (this.securityInterceptor == null) {
|
||||
throw new IllegalArgumentException("securityInterceptor required");
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ public class AnnotationSecurityAspectTests {
|
|||
private PrePostSecured prePostSecured = new PrePostSecured();
|
||||
|
||||
@Before
|
||||
public final void setUp() throws Exception {
|
||||
public final void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
interceptor = new AspectJMethodSecurityInterceptor();
|
||||
AccessDecisionVoter[] voters = new AccessDecisionVoter[] {
|
||||
|
@ -90,17 +90,17 @@ public class AnnotationSecurityAspectTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void securedInterfaceMethodAllowsAllAccess() throws Exception {
|
||||
public void securedInterfaceMethodAllowsAllAccess() {
|
||||
secured.securedMethod();
|
||||
}
|
||||
|
||||
@Test(expected = AuthenticationCredentialsNotFoundException.class)
|
||||
public void securedClassMethodDeniesUnauthenticatedAccess() throws Exception {
|
||||
public void securedClassMethodDeniesUnauthenticatedAccess() {
|
||||
secured.securedClassMethod();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void securedClassMethodAllowsAccessToRoleA() throws Exception {
|
||||
public void securedClassMethodAllowsAccessToRoleA() {
|
||||
SecurityContextHolder.getContext().setAuthentication(anne);
|
||||
secured.securedClassMethod();
|
||||
}
|
||||
|
@ -119,28 +119,28 @@ public class AnnotationSecurityAspectTests {
|
|||
}
|
||||
|
||||
@Test(expected = AccessDeniedException.class)
|
||||
public void protectedMethodIsIntercepted() throws Exception {
|
||||
public void protectedMethodIsIntercepted() {
|
||||
SecurityContextHolder.getContext().setAuthentication(anne);
|
||||
|
||||
secured.protectedMethod();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void overriddenProtectedMethodIsNotIntercepted() throws Exception {
|
||||
public void overriddenProtectedMethodIsNotIntercepted() {
|
||||
// AspectJ doesn't inherit annotations
|
||||
securedSub.protectedMethod();
|
||||
}
|
||||
|
||||
// SEC-1262
|
||||
@Test(expected = AccessDeniedException.class)
|
||||
public void denyAllPreAuthorizeDeniesAccess() throws Exception {
|
||||
public void denyAllPreAuthorizeDeniesAccess() {
|
||||
configureForElAnnotations();
|
||||
SecurityContextHolder.getContext().setAuthentication(anne);
|
||||
prePostSecured.denyAllMethod();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void postFilterIsApplied() throws Exception {
|
||||
public void postFilterIsApplied() {
|
||||
configureForElAnnotations();
|
||||
SecurityContextHolder.getContext().setAuthentication(anne);
|
||||
List<String> objects = prePostSecured.postFilterMethod();
|
||||
|
|
|
@ -50,7 +50,7 @@ public class ServiceProperties implements InitializingBean {
|
|||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
public void afterPropertiesSet() {
|
||||
Assert.hasLength(this.service, "service cannot be empty.");
|
||||
Assert.hasLength(this.artifactParameter, "artifactParameter cannot be empty.");
|
||||
Assert.hasLength(this.serviceParameter, "serviceParameter cannot be empty.");
|
||||
|
|
|
@ -77,7 +77,7 @@ public class CasAuthenticationProvider implements AuthenticationProvider,
|
|||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(this.authenticationUserDetailsService,
|
||||
"An authenticationUserDetailsService must be set");
|
||||
Assert.notNull(this.ticketValidator, "A ticketValidator must be set");
|
||||
|
|
|
@ -44,7 +44,7 @@ public class EhCacheBasedTicketCache implements StatelessTicketCache, Initializi
|
|||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(cache, "cache mandatory");
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public class SpringCacheBasedTicketCache implements StatelessTicketCache {
|
|||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public SpringCacheBasedTicketCache(Cache cache) throws Exception {
|
||||
public SpringCacheBasedTicketCache(Cache cache) {
|
||||
Assert.notNull(cache, "cache mandatory");
|
||||
this.cache = cache;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public class CasAuthenticationEntryPoint implements AuthenticationEntryPoint,
|
|||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
public void afterPropertiesSet() {
|
||||
Assert.hasLength(this.loginUrl, "loginUrl must be specified");
|
||||
Assert.notNull(this.serviceProperties, "serviceProperties must be specified");
|
||||
Assert.notNull(this.serviceProperties.getService(),
|
||||
|
@ -74,8 +74,7 @@ public class CasAuthenticationEntryPoint implements AuthenticationEntryPoint,
|
|||
|
||||
public final void commence(final HttpServletRequest servletRequest,
|
||||
final HttpServletResponse response,
|
||||
final AuthenticationException authenticationException) throws IOException,
|
||||
ServletException {
|
||||
final AuthenticationException authenticationException) throws IOException {
|
||||
|
||||
final String urlEncodedService = createServiceUrl(servletRequest, response);
|
||||
final String redirectUrl = createRedirectUrl(urlEncodedService);
|
||||
|
|
|
@ -418,8 +418,7 @@ public class CasAuthenticationProviderTests {
|
|||
this.returnTicket = returnTicket;
|
||||
}
|
||||
|
||||
public Assertion validate(final String ticket, final String service)
|
||||
throws TicketValidationException {
|
||||
public Assertion validate(final String ticket, final String service) {
|
||||
if (returnTicket) {
|
||||
return new AssertionImpl("rod");
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ public class CasAuthenticationTokenMixinTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void deserializeCasAuthenticationTest() throws IOException, JSONException {
|
||||
public void deserializeCasAuthenticationTest() throws IOException {
|
||||
CasAuthenticationToken token = mapper.readValue(CAS_TOKEN_JSON, CasAuthenticationToken.class);
|
||||
assertThat(token).isNotNull();
|
||||
assertThat(token.getPrincipal()).isNotNull().isInstanceOf(User.class);
|
||||
|
|
|
@ -59,7 +59,7 @@ public class LdapUserServiceBeanDefinitionParserTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void beanClassNamesAreCorrect() throws Exception {
|
||||
public void beanClassNamesAreCorrect() {
|
||||
assertThat(FilterBasedLdapUserSearch.class.getName()).isEqualTo(LDAP_SEARCH_CLASS);
|
||||
assertThat(PersonContextMapper.class.getName()).isEqualTo(PERSON_MAPPER_CLASS);
|
||||
assertThat(InetOrgPersonContextMapper.class.getName()).isEqualTo(INET_ORG_PERSON_MAPPER_CLASS);
|
||||
|
@ -69,12 +69,12 @@ public class LdapUserServiceBeanDefinitionParserTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void minimalConfigurationIsParsedOk() throws Exception {
|
||||
public void minimalConfigurationIsParsedOk() {
|
||||
setContext("<ldap-user-service user-search-filter='(uid={0})' /><ldap-server ldif='classpath:test-server.ldif' url='ldap://127.0.0.1:343/dc=springframework,dc=org' />");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void userServiceReturnsExpectedData() throws Exception {
|
||||
public void userServiceReturnsExpectedData() {
|
||||
setContext("<ldap-user-service id='ldapUDS' user-search-filter='(uid={0})' group-search-filter='member={0}' /><ldap-server ldif='classpath:test-server.ldif'/>");
|
||||
|
||||
UserDetailsService uds = (UserDetailsService) appCtx.getBean("ldapUDS");
|
||||
|
@ -86,7 +86,7 @@ public class LdapUserServiceBeanDefinitionParserTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void differentUserSearchBaseWorksAsExpected() throws Exception {
|
||||
public void differentUserSearchBaseWorksAsExpected() {
|
||||
setContext("<ldap-user-service id='ldapUDS' "
|
||||
+ " user-search-base='ou=otherpeople' "
|
||||
+ " user-search-filter='(cn={0})' "
|
||||
|
@ -99,7 +99,7 @@ public class LdapUserServiceBeanDefinitionParserTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void rolePrefixIsSupported() throws Exception {
|
||||
public void rolePrefixIsSupported() {
|
||||
setContext("<ldap-user-service id='ldapUDS' "
|
||||
+ " user-search-filter='(uid={0})' "
|
||||
+ " group-search-filter='member={0}' role-prefix='PREFIX_'/>"
|
||||
|
@ -117,7 +117,7 @@ public class LdapUserServiceBeanDefinitionParserTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void differentGroupRoleAttributeWorksAsExpected() throws Exception {
|
||||
public void differentGroupRoleAttributeWorksAsExpected() {
|
||||
setContext("<ldap-user-service id='ldapUDS' user-search-filter='(uid={0})' group-role-attribute='ou' group-search-filter='member={0}' /><ldap-server ldif='classpath:test-server.ldif'/>");
|
||||
|
||||
UserDetailsService uds = (UserDetailsService) appCtx.getBean("ldapUDS");
|
||||
|
|
|
@ -183,10 +183,9 @@ public abstract class AbstractConfiguredSecurityBuilder<O, B extends SecurityBui
|
|||
* {@link SecurityConfigurer#init(SecurityBuilder)} immediately if necessary.
|
||||
*
|
||||
* @param configurer the {@link SecurityConfigurer} to add
|
||||
* @throws Exception if an error occurs
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private <C extends SecurityConfigurer<O, B>> void add(C configurer) throws Exception {
|
||||
private <C extends SecurityConfigurer<O, B>> void add(C configurer) {
|
||||
Assert.notNull(configurer, "configurer cannot be null");
|
||||
|
||||
Class<? extends SecurityConfigurer<O, B>> clazz = (Class<? extends SecurityConfigurer<O, B>>) configurer
|
||||
|
@ -344,7 +343,7 @@ public abstract class AbstractConfiguredSecurityBuilder<O, B extends SecurityBui
|
|||
* method. Subclasses may override this method to hook into the lifecycle without
|
||||
* using a {@link SecurityConfigurer}.
|
||||
*/
|
||||
protected void beforeInit() throws Exception {
|
||||
protected void beforeInit() {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -228,7 +228,7 @@ public class AuthenticationManagerBuilder
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ProviderManager performBuild() throws Exception {
|
||||
protected ProviderManager performBuild() {
|
||||
if (!isConfigured()) {
|
||||
logger.debug("No authenticationProviders and no parentAuthenticationManager defined. Returning null.");
|
||||
return null;
|
||||
|
|
|
@ -128,7 +128,7 @@ public class AuthenticationConfiguration {
|
|||
|
||||
@Autowired(required = false)
|
||||
public void setGlobalAuthenticationConfigurers(
|
||||
List<GlobalAuthenticationConfigurerAdapter> configurers) throws Exception {
|
||||
List<GlobalAuthenticationConfigurerAdapter> configurers) {
|
||||
configurers.sort(AnnotationAwareOrderComparator.INSTANCE);
|
||||
this.globalAuthConfigurers = configurers;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ class InitializeAuthenticationProviderBeanManagerConfigurer
|
|||
class InitializeUserDetailsManagerConfigurer
|
||||
extends GlobalAuthenticationConfigurerAdapter {
|
||||
@Override
|
||||
public void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
public void configure(AuthenticationManagerBuilder auth) {
|
||||
if (auth.isConfigured()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -64,10 +64,8 @@ public class JdbcUserDetailsManagerConfigurer<B extends ProviderManagerBuilder<B
|
|||
*
|
||||
* @param dataSource the {@link DataSource} to be used. Cannot be null.
|
||||
* @return The {@link JdbcUserDetailsManagerConfigurer} used for additional customizations
|
||||
* @throws Exception
|
||||
*/
|
||||
public JdbcUserDetailsManagerConfigurer<B> dataSource(DataSource dataSource)
|
||||
throws Exception {
|
||||
public JdbcUserDetailsManagerConfigurer<B> dataSource(DataSource dataSource) {
|
||||
this.dataSource = dataSource;
|
||||
getUserDetailsService().setDataSource(dataSource);
|
||||
return this;
|
||||
|
@ -83,10 +81,8 @@ public class JdbcUserDetailsManagerConfigurer<B extends ProviderManagerBuilder<B
|
|||
* is enabled by username. Must contain a single parameter for the username.
|
||||
* @return The {@link JdbcUserDetailsManagerConfigurer} used for additional
|
||||
* customizations
|
||||
* @throws Exception
|
||||
*/
|
||||
public JdbcUserDetailsManagerConfigurer<B> usersByUsernameQuery(String query)
|
||||
throws Exception {
|
||||
public JdbcUserDetailsManagerConfigurer<B> usersByUsernameQuery(String query) {
|
||||
getUserDetailsService().setUsersByUsernameQuery(query);
|
||||
return this;
|
||||
}
|
||||
|
@ -103,10 +99,8 @@ public class JdbcUserDetailsManagerConfigurer<B extends ProviderManagerBuilder<B
|
|||
* Must contain a single parameter for the username.
|
||||
* @return The {@link JdbcUserDetailsManagerConfigurer} used for additional
|
||||
* customizations
|
||||
* @throws Exception
|
||||
*/
|
||||
public JdbcUserDetailsManagerConfigurer<B> authoritiesByUsernameQuery(String query)
|
||||
throws Exception {
|
||||
public JdbcUserDetailsManagerConfigurer<B> authoritiesByUsernameQuery(String query) {
|
||||
getUserDetailsService().setAuthoritiesByUsernameQuery(query);
|
||||
return this;
|
||||
}
|
||||
|
@ -127,10 +121,8 @@ public class JdbcUserDetailsManagerConfigurer<B extends ProviderManagerBuilder<B
|
|||
* a single parameter for the username.
|
||||
* @return The {@link JdbcUserDetailsManagerConfigurer} used for additional
|
||||
* customizations
|
||||
* @throws Exception
|
||||
*/
|
||||
public JdbcUserDetailsManagerConfigurer<B> groupAuthoritiesByUsername(String query)
|
||||
throws Exception {
|
||||
public JdbcUserDetailsManagerConfigurer<B> groupAuthoritiesByUsername(String query) {
|
||||
JdbcUserDetailsManager userDetailsService = getUserDetailsService();
|
||||
userDetailsService.setEnableGroups(true);
|
||||
userDetailsService.setGroupAuthoritiesByUsernameQuery(query);
|
||||
|
@ -143,10 +135,8 @@ public class JdbcUserDetailsManagerConfigurer<B extends ProviderManagerBuilder<B
|
|||
*
|
||||
* @param rolePrefix
|
||||
* @return The {@link JdbcUserDetailsManagerConfigurer} used for additional customizations
|
||||
* @throws Exception
|
||||
*/
|
||||
public JdbcUserDetailsManagerConfigurer<B> rolePrefix(String rolePrefix)
|
||||
throws Exception {
|
||||
public JdbcUserDetailsManagerConfigurer<B> rolePrefix(String rolePrefix) {
|
||||
getUserDetailsService().setRolePrefix(rolePrefix);
|
||||
return this;
|
||||
}
|
||||
|
@ -156,10 +146,8 @@ public class JdbcUserDetailsManagerConfigurer<B extends ProviderManagerBuilder<B
|
|||
*
|
||||
* @param userCache the {@link UserCache} to use
|
||||
* @return the {@link JdbcUserDetailsManagerConfigurer} for further customizations
|
||||
* @throws Exception
|
||||
*/
|
||||
public JdbcUserDetailsManagerConfigurer<B> userCache(UserCache userCache)
|
||||
throws Exception {
|
||||
public JdbcUserDetailsManagerConfigurer<B> userCache(UserCache userCache) {
|
||||
getUserDetailsService().setUserCache(userCache);
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ final class AutowireBeanFactoryObjectPostProcessor
|
|||
*
|
||||
* @see org.springframework.beans.factory.DisposableBean#destroy()
|
||||
*/
|
||||
public void destroy() throws Exception {
|
||||
public void destroy() {
|
||||
for (DisposableBean disposable : this.disposableBeans) {
|
||||
try {
|
||||
disposable.destroy();
|
||||
|
|
|
@ -46,7 +46,7 @@ class ReactiveMethodSecurityConfiguration implements ImportAware {
|
|||
|
||||
@Bean
|
||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||
public MethodSecurityMetadataSourceAdvisor methodSecurityInterceptor(AbstractMethodSecurityMetadataSource source) throws Exception {
|
||||
public MethodSecurityMetadataSourceAdvisor methodSecurityInterceptor(AbstractMethodSecurityMetadataSource source) {
|
||||
MethodSecurityMetadataSourceAdvisor advisor = new MethodSecurityMetadataSourceAdvisor(
|
||||
"securityMethodInterceptor", source, "methodMetadataSource");
|
||||
advisor.setOrder(advisorOrder);
|
||||
|
|
|
@ -2325,7 +2325,7 @@ public final class HttpSecurity extends
|
|||
}
|
||||
|
||||
@Override
|
||||
protected DefaultSecurityFilterChain performBuild() throws Exception {
|
||||
protected DefaultSecurityFilterChain performBuild() {
|
||||
filters.sort(comparator);
|
||||
return new DefaultSecurityFilterChain(requestMatcher, filters);
|
||||
}
|
||||
|
@ -2633,9 +2633,8 @@ public final class HttpSecurity extends
|
|||
* @param requestMatcherCustomizer the {@link Customizer} to provide more options for
|
||||
* the {@link RequestMatcherConfigurer}
|
||||
* @return the {@link HttpSecurity} for further customizations
|
||||
* @throws Exception
|
||||
*/
|
||||
public HttpSecurity requestMatchers(Customizer<RequestMatcherConfigurer> requestMatcherCustomizer) throws Exception {
|
||||
public HttpSecurity requestMatchers(Customizer<RequestMatcherConfigurer> requestMatcherCustomizer) {
|
||||
requestMatcherCustomizer.customize(requestMatcherConfigurer);
|
||||
return HttpSecurity.this;
|
||||
}
|
||||
|
|
|
@ -108,11 +108,10 @@ public class WebSecurityConfiguration implements ImportAware, BeanClassLoaderAwa
|
|||
* Creates the {@link WebInvocationPrivilegeEvaluator} that is necessary for the JSP
|
||||
* tag support.
|
||||
* @return the {@link WebInvocationPrivilegeEvaluator}
|
||||
* @throws Exception
|
||||
*/
|
||||
@Bean
|
||||
@DependsOn(AbstractSecurityWebApplicationInitializer.DEFAULT_FILTER_NAME)
|
||||
public WebInvocationPrivilegeEvaluator privilegeEvaluator() throws Exception {
|
||||
public WebInvocationPrivilegeEvaluator privilegeEvaluator() {
|
||||
return webSecurity.getPrivilegeEvaluator();
|
||||
}
|
||||
|
||||
|
|
|
@ -331,7 +331,7 @@ public abstract class WebSecurityConfigurerAdapter implements
|
|||
* Override this method to configure {@link WebSecurity}. For example, if you wish to
|
||||
* ignore certain requests.
|
||||
*/
|
||||
public void configure(WebSecurity web) throws Exception {
|
||||
public void configure(WebSecurity web) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -145,7 +145,7 @@ public final class AnonymousConfigurer<H extends HttpSecurityBuilder<H>> extends
|
|||
}
|
||||
|
||||
@Override
|
||||
public void init(H http) throws Exception {
|
||||
public void init(H http) {
|
||||
if (authenticationProvider == null) {
|
||||
authenticationProvider = new AnonymousAuthenticationProvider(getKey());
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ public final class AnonymousConfigurer<H extends HttpSecurityBuilder<H>> extends
|
|||
}
|
||||
|
||||
@Override
|
||||
public void configure(H http) throws Exception {
|
||||
public void configure(H http) {
|
||||
authenticationFilter.afterPropertiesSet();
|
||||
http.addFilter(authenticationFilter);
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ public final class ChannelSecurityConfigurer<H extends HttpSecurityBuilder<H>> e
|
|||
}
|
||||
|
||||
@Override
|
||||
public void configure(H http) throws Exception {
|
||||
public void configure(H http) {
|
||||
ChannelDecisionManagerImpl channelDecisionManager = new ChannelDecisionManagerImpl();
|
||||
channelDecisionManager.setChannelProcessors(getChannelProcessors(http));
|
||||
channelDecisionManager = postProcess(channelDecisionManager);
|
||||
|
|
|
@ -60,7 +60,7 @@ public class CorsConfigurer<H extends HttpSecurityBuilder<H>>
|
|||
}
|
||||
|
||||
@Override
|
||||
public void configure(H http) throws Exception {
|
||||
public void configure(H http) {
|
||||
ApplicationContext context = http.getSharedObject(ApplicationContext.class);
|
||||
|
||||
CorsFilter corsFilter = getCorsFilter(context);
|
||||
|
|
|
@ -203,7 +203,7 @@ public final class CsrfConfigurer<H extends HttpSecurityBuilder<H>>
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void configure(H http) throws Exception {
|
||||
public void configure(H http) {
|
||||
CsrfFilter filter = new CsrfFilter(this.csrfTokenRepository);
|
||||
RequestMatcher requireCsrfProtectionMatcher = getRequireCsrfProtectionMatcher();
|
||||
if (requireCsrfProtectionMatcher != null) {
|
||||
|
|
|
@ -73,7 +73,7 @@ public final class DefaultLoginPageConfigurer<H extends HttpSecurityBuilder<H>>
|
|||
private DefaultLogoutPageGeneratingFilter logoutPageGeneratingFilter = new DefaultLogoutPageGeneratingFilter();
|
||||
|
||||
@Override
|
||||
public void init(H http) throws Exception {
|
||||
public void init(H http) {
|
||||
Function<HttpServletRequest, Map<String, String>> hiddenInputs = request -> {
|
||||
CsrfToken token = (CsrfToken) request.getAttribute(CsrfToken.class.getName());
|
||||
if (token == null) {
|
||||
|
@ -89,7 +89,7 @@ public final class DefaultLoginPageConfigurer<H extends HttpSecurityBuilder<H>>
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void configure(H http) throws Exception {
|
||||
public void configure(H http) {
|
||||
AuthenticationEntryPoint authenticationEntryPoint = null;
|
||||
ExceptionHandlingConfigurer<?> exceptionConf = http
|
||||
.getConfigurer(ExceptionHandlingConfigurer.class);
|
||||
|
|
|
@ -188,7 +188,7 @@ public final class ExceptionHandlingConfigurer<H extends HttpSecurityBuilder<H>>
|
|||
}
|
||||
|
||||
@Override
|
||||
public void configure(H http) throws Exception {
|
||||
public void configure(H http) {
|
||||
AuthenticationEntryPoint entryPoint = getAuthenticationEntryPoint(http);
|
||||
ExceptionTranslationFilter exceptionTranslationFilter = new ExceptionTranslationFilter(
|
||||
entryPoint, getRequestCache(http));
|
||||
|
|
|
@ -899,7 +899,7 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>> extends
|
|||
}
|
||||
|
||||
@Override
|
||||
public void configure(H http) throws Exception {
|
||||
public void configure(H http) {
|
||||
HeaderWriterFilter headersFilter = createHeaderWriterFilter();
|
||||
http.addFilter(headersFilter);
|
||||
}
|
||||
|
|
|
@ -91,10 +91,9 @@ public final class HttpBasicConfigurer<B extends HttpSecurityBuilder<B>> extends
|
|||
|
||||
/**
|
||||
* Creates a new instance
|
||||
* @throws Exception
|
||||
* @see HttpSecurity#httpBasic()
|
||||
*/
|
||||
public HttpBasicConfigurer() throws Exception {
|
||||
public HttpBasicConfigurer() {
|
||||
realmName(DEFAULT_REALM);
|
||||
|
||||
LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> entryPoints = new LinkedHashMap<>();
|
||||
|
@ -150,7 +149,7 @@ public final class HttpBasicConfigurer<B extends HttpSecurityBuilder<B>> extends
|
|||
}
|
||||
|
||||
@Override
|
||||
public void init(B http) throws Exception {
|
||||
public void init(B http) {
|
||||
registerDefaults(http);
|
||||
}
|
||||
|
||||
|
@ -204,7 +203,7 @@ public final class HttpBasicConfigurer<B extends HttpSecurityBuilder<B>> extends
|
|||
}
|
||||
|
||||
@Override
|
||||
public void configure(B http) throws Exception {
|
||||
public void configure(B http) {
|
||||
AuthenticationManager authenticationManager = http
|
||||
.getSharedObject(AuthenticationManager.class);
|
||||
BasicAuthenticationFilter basicAuthenticationFilter = new BasicAuthenticationFilter(
|
||||
|
|
|
@ -192,7 +192,7 @@ public final class JeeConfigurer<H extends HttpSecurityBuilder<H>> extends
|
|||
* @see org.springframework.security.config.annotation.SecurityConfigurerAdapter#init(org.springframework.security.config.annotation.SecurityBuilder)
|
||||
*/
|
||||
@Override
|
||||
public void init(H http) throws Exception {
|
||||
public void init(H http) {
|
||||
PreAuthenticatedAuthenticationProvider authenticationProvider = new PreAuthenticatedAuthenticationProvider();
|
||||
authenticationProvider
|
||||
.setPreAuthenticatedUserDetailsService(getUserDetailsService());
|
||||
|
@ -206,7 +206,7 @@ public final class JeeConfigurer<H extends HttpSecurityBuilder<H>> extends
|
|||
}
|
||||
|
||||
@Override
|
||||
public void configure(H http) throws Exception {
|
||||
public void configure(H http) {
|
||||
J2eePreAuthenticatedProcessingFilter filter = getFilter(http
|
||||
.getSharedObject(AuthenticationManager.class));
|
||||
http.addFilter(filter);
|
||||
|
|
|
@ -270,7 +270,7 @@ public final class LogoutConfigurer<H extends HttpSecurityBuilder<H>> extends
|
|||
}
|
||||
|
||||
@Override
|
||||
public void init(H http) throws Exception {
|
||||
public void init(H http) {
|
||||
if (permitAll) {
|
||||
PermitAllSupport.permitAll(http, this.logoutSuccessUrl);
|
||||
PermitAllSupport.permitAll(http, this.getLogoutRequestMatcher(http));
|
||||
|
@ -325,9 +325,8 @@ public final class LogoutConfigurer<H extends HttpSecurityBuilder<H>> extends
|
|||
*
|
||||
* @param http the builder to use
|
||||
* @return the {@link LogoutFilter} to use.
|
||||
* @throws Exception
|
||||
*/
|
||||
private LogoutFilter createLogoutFilter(H http) throws Exception {
|
||||
private LogoutFilter createLogoutFilter(H http) {
|
||||
logoutHandlers.add(contextLogoutHandler);
|
||||
LogoutHandler[] handlers = logoutHandlers
|
||||
.toArray(new LogoutHandler[0]);
|
||||
|
|
|
@ -62,7 +62,7 @@ public final class PortMapperConfigurer<H extends HttpSecurityBuilder<H>> extend
|
|||
}
|
||||
|
||||
@Override
|
||||
public void init(H http) throws Exception {
|
||||
public void init(H http) {
|
||||
http.setSharedObject(PortMapper.class, getPortMapper());
|
||||
}
|
||||
|
||||
|
|
|
@ -282,7 +282,7 @@ public final class RememberMeConfigurer<H extends HttpSecurityBuilder<H>>
|
|||
}
|
||||
|
||||
@Override
|
||||
public void configure(H http) throws Exception {
|
||||
public void configure(H http) {
|
||||
RememberMeAuthenticationFilter rememberMeFilter = new RememberMeAuthenticationFilter(
|
||||
http.getSharedObject(AuthenticationManager.class),
|
||||
this.rememberMeServices);
|
||||
|
@ -373,10 +373,8 @@ public final class RememberMeConfigurer<H extends HttpSecurityBuilder<H>>
|
|||
* @param http the {@link HttpSecurity} to lookup shared objects
|
||||
* @param key the {@link #key(String)}
|
||||
* @return the {@link RememberMeServices} to use
|
||||
* @throws Exception
|
||||
*/
|
||||
private AbstractRememberMeServices createRememberMeServices(H http, String key)
|
||||
throws Exception {
|
||||
private AbstractRememberMeServices createRememberMeServices(H http, String key) {
|
||||
return this.tokenRepository == null
|
||||
? createTokenBasedRememberMeServices(http, key)
|
||||
: createPersistentRememberMeServices(http, key);
|
||||
|
|
|
@ -95,12 +95,12 @@ public final class RequestCacheConfigurer<H extends HttpSecurityBuilder<H>> exte
|
|||
}
|
||||
|
||||
@Override
|
||||
public void init(H http) throws Exception {
|
||||
public void init(H http) {
|
||||
http.setSharedObject(RequestCache.class, getRequestCache(http));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(H http) throws Exception {
|
||||
public void configure(H http) {
|
||||
RequestCache requestCache = getRequestCache(http);
|
||||
RequestCacheAwareFilter requestCacheFilter = new RequestCacheAwareFilter(
|
||||
requestCache);
|
||||
|
|
|
@ -82,7 +82,7 @@ public final class SecurityContextConfigurer<H extends HttpSecurityBuilder<H>> e
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void configure(H http) throws Exception {
|
||||
public void configure(H http) {
|
||||
|
||||
SecurityContextRepository securityContextRepository = http
|
||||
.getSharedObject(SecurityContextRepository.class);
|
||||
|
|
|
@ -75,7 +75,7 @@ public final class ServletApiConfigurer<H extends HttpSecurityBuilder<H>> extend
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void configure(H http) throws Exception {
|
||||
public void configure(H http) {
|
||||
securityContextRequestFilter.setAuthenticationManager(http
|
||||
.getSharedObject(AuthenticationManager.class));
|
||||
ExceptionHandlingConfigurer<H> exceptionConf = http
|
||||
|
|
|
@ -441,7 +441,7 @@ public final class SessionManagementConfigurer<H extends HttpSecurityBuilder<H>>
|
|||
}
|
||||
|
||||
@Override
|
||||
public void init(H http) throws Exception {
|
||||
public void init(H http) {
|
||||
SecurityContextRepository securityContextRepository = http
|
||||
.getSharedObject(SecurityContextRepository.class);
|
||||
boolean stateless = isStateless();
|
||||
|
@ -478,7 +478,7 @@ public final class SessionManagementConfigurer<H extends HttpSecurityBuilder<H>>
|
|||
}
|
||||
|
||||
@Override
|
||||
public void configure(H http) throws Exception {
|
||||
public void configure(H http) {
|
||||
SecurityContextRepository securityContextRepository = http
|
||||
.getSharedObject(SecurityContextRepository.class);
|
||||
SessionManagementFilter sessionManagementFilter = new SessionManagementFilter(
|
||||
|
|
|
@ -171,7 +171,7 @@ public final class X509Configurer<H extends HttpSecurityBuilder<H>> extends
|
|||
|
||||
// @formatter:off
|
||||
@Override
|
||||
public void init(H http) throws Exception {
|
||||
public void init(H http) {
|
||||
PreAuthenticatedAuthenticationProvider authenticationProvider = new PreAuthenticatedAuthenticationProvider();
|
||||
authenticationProvider.setPreAuthenticatedUserDetailsService(getAuthenticationUserDetailsService(http));
|
||||
|
||||
|
@ -182,7 +182,7 @@ public final class X509Configurer<H extends HttpSecurityBuilder<H>> extends
|
|||
// @formatter:on
|
||||
|
||||
@Override
|
||||
public void configure(H http) throws Exception {
|
||||
public void configure(H http) {
|
||||
X509AuthenticationFilter filter = getFilter(http
|
||||
.getSharedObject(AuthenticationManager.class));
|
||||
http.addFilter(filter);
|
||||
|
|
|
@ -83,7 +83,7 @@ public final class ImplicitGrantConfigurer<B extends HttpSecurityBuilder<B>> ext
|
|||
}
|
||||
|
||||
@Override
|
||||
public void configure(B http) throws Exception {
|
||||
public void configure(B http) {
|
||||
OAuth2AuthorizationRequestRedirectFilter authorizationRequestFilter = new OAuth2AuthorizationRequestRedirectFilter(
|
||||
OAuth2ClientConfigurerUtils.getClientRegistrationRepository(this.getBuilder()), this.getAuthorizationRequestBaseUri());
|
||||
http.addFilter(this.postProcess(authorizationRequestFilter));
|
||||
|
|
|
@ -142,10 +142,8 @@ public final class OAuth2ClientConfigurer<B extends HttpSecurityBuilder<B>> exte
|
|||
* @param authorizationCodeGrantCustomizer the {@link Customizer} to provide more options for
|
||||
* the {@link AuthorizationCodeGrantConfigurer}
|
||||
* @return the {@link OAuth2ClientConfigurer} for further customizations
|
||||
* @throws Exception
|
||||
*/
|
||||
public OAuth2ClientConfigurer<B> authorizationCodeGrant(Customizer<AuthorizationCodeGrantConfigurer> authorizationCodeGrantCustomizer)
|
||||
throws Exception {
|
||||
public OAuth2ClientConfigurer<B> authorizationCodeGrant(Customizer<AuthorizationCodeGrantConfigurer> authorizationCodeGrantCustomizer) {
|
||||
authorizationCodeGrantCustomizer.customize(this.authorizationCodeGrantConfigurer);
|
||||
return this;
|
||||
}
|
||||
|
@ -270,12 +268,12 @@ public final class OAuth2ClientConfigurer<B extends HttpSecurityBuilder<B>> exte
|
|||
}
|
||||
|
||||
@Override
|
||||
public void init(B builder) throws Exception {
|
||||
public void init(B builder) {
|
||||
this.authorizationCodeGrantConfigurer.init(builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(B builder) throws Exception {
|
||||
public void configure(B builder) {
|
||||
this.authorizationCodeGrantConfigurer.configure(builder);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -221,14 +221,14 @@ public final class OAuth2ResourceServerConfigurer<H extends HttpSecurityBuilder<
|
|||
}
|
||||
|
||||
@Override
|
||||
public void init(H http) throws Exception {
|
||||
public void init(H http) {
|
||||
registerDefaultAccessDeniedHandler(http);
|
||||
registerDefaultEntryPoint(http);
|
||||
registerDefaultCsrfOverride(http);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(H http) throws Exception {
|
||||
public void configure(H http) {
|
||||
BearerTokenResolver bearerTokenResolver = getBearerTokenResolver();
|
||||
this.requestMatcher.setBearerTokenResolver(bearerTokenResolver);
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public class UserDetailsMapFactoryBean implements FactoryBean<Collection<UserDet
|
|||
}
|
||||
|
||||
@Override
|
||||
public Collection<UserDetails> getObject() throws Exception {
|
||||
public Collection<UserDetails> getObject() {
|
||||
Collection<UserDetails> users = new ArrayList<>(this.userProperties.size());
|
||||
|
||||
UserAttributeEditor editor = new UserAttributeEditor();
|
||||
|
|
|
@ -32,7 +32,7 @@ public class DataSourcePopulator implements InitializingBean {
|
|||
|
||||
JdbcTemplate template;
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(template, "dataSource required");
|
||||
|
||||
template.execute("CREATE TABLE USERS(USERNAME VARCHAR_IGNORECASE(50) NOT NULL PRIMARY KEY,PASSWORD VARCHAR_IGNORECASE(500) NOT NULL,ENABLED BOOLEAN NOT NULL);");
|
||||
|
|
|
@ -105,7 +105,7 @@ public class FilterChainProxyConfigTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void pathWithNoMatchHasNoFilters() throws Exception {
|
||||
public void pathWithNoMatchHasNoFilters() {
|
||||
FilterChainProxy filterChainProxy = appCtx.getBean(
|
||||
"newFilterChainProxyNoDefaultPath", FilterChainProxy.class);
|
||||
assertThat(filterChainProxy.getFilters("/nomatch")).isNull();
|
||||
|
@ -113,7 +113,7 @@ public class FilterChainProxyConfigTests {
|
|||
|
||||
// SEC-1235
|
||||
@Test
|
||||
public void mixingPatternsAndPlaceholdersDoesntCauseOrderingIssues() throws Exception {
|
||||
public void mixingPatternsAndPlaceholdersDoesntCauseOrderingIssues() {
|
||||
FilterChainProxy fcp = appCtx.getBean("sec1235FilterChainProxy",
|
||||
FilterChainProxy.class);
|
||||
|
||||
|
@ -128,8 +128,7 @@ public class FilterChainProxyConfigTests {
|
|||
.getRequestMatcher()).getPattern();
|
||||
}
|
||||
|
||||
private void checkPathAndFilterOrder(FilterChainProxy filterChainProxy)
|
||||
throws Exception {
|
||||
private void checkPathAndFilterOrder(FilterChainProxy filterChainProxy) {
|
||||
List<Filter> filters = filterChainProxy.getFilters("/foo/blah;x=1");
|
||||
assertThat(filters).hasSize(1);
|
||||
assertThat(filters.get(0) instanceof SecurityContextHolderAwareRequestFilter).isTrue();
|
||||
|
|
|
@ -72,7 +72,7 @@ public class SecurityNamespaceHandlerTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void pre32SchemaAreNotSupported() throws Exception {
|
||||
public void pre32SchemaAreNotSupported() {
|
||||
try {
|
||||
new InMemoryXmlApplicationContext(
|
||||
"<user-service id='us'>"
|
||||
|
|
|
@ -27,7 +27,7 @@ class ConcereteSecurityConfigurerAdapter extends
|
|||
private List<Object> list = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void configure(SecurityBuilder<Object> builder) throws Exception {
|
||||
public void configure(SecurityBuilder<Object> builder) {
|
||||
list = postProcess(list);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public class NamespaceAuthenticationProviderTests {
|
|||
|
||||
@EnableWebSecurity
|
||||
static class AuthenticationProviderRefConfig extends WebSecurityConfigurerAdapter {
|
||||
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
protected void configure(AuthenticationManagerBuilder auth) {
|
||||
auth
|
||||
.authenticationProvider(authenticationProvider());
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public class PasswordEncoderConfigurerTests {
|
|||
// @formatter:on
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
protected void configure(HttpSecurity http) {
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -203,7 +203,7 @@ public class AuthenticationConfigurationTests {
|
|||
inits.add(getClass());
|
||||
}
|
||||
|
||||
public void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
public void configure(AuthenticationManagerBuilder auth) {
|
||||
configs.add(getClass());
|
||||
}
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ public class AuthenticationConfigurationTests {
|
|||
|
||||
static class DefaultBootGlobalAuthenticationConfigurerAdapter extends DefaultOrderGlobalAuthenticationConfigurerAdapter {
|
||||
@Override
|
||||
public void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
public void configure(AuthenticationManagerBuilder auth) {
|
||||
if (auth.isConfigured()) {
|
||||
return;
|
||||
}
|
||||
|
@ -477,7 +477,7 @@ public class AuthenticationConfigurationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void enableGlobalMethodSecurityWhenPreAuthorizeThenNoException() throws Exception {
|
||||
public void enableGlobalMethodSecurityWhenPreAuthorizeThenNoException() {
|
||||
this.spring.register(UsesPreAuthorizeMethodSecurityConfig.class, AuthenticationManagerBeanConfig.class).autowire();
|
||||
|
||||
// no exception
|
||||
|
@ -491,7 +491,7 @@ public class AuthenticationConfigurationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void enableGlobalMethodSecurityWhenPreAuthorizeThenUsesMethodSecurityService() throws Exception {
|
||||
public void enableGlobalMethodSecurityWhenPreAuthorizeThenUsesMethodSecurityService() {
|
||||
this.spring.register(ServicesConfig.class, UsesPreAuthorizeMethodSecurityConfig.class, AuthenticationManagerBeanConfig.class).autowire();
|
||||
|
||||
// no exception
|
||||
|
|
|
@ -154,7 +154,7 @@ public class AutowireBeanFactoryObjectPostProcessorTests {
|
|||
|
||||
@Test
|
||||
// SEC-2382
|
||||
public void autowireBeanFactoryWhenBeanNameAutoProxyCreatorThenWorks() throws Exception {
|
||||
public void autowireBeanFactoryWhenBeanNameAutoProxyCreatorThenWorks() {
|
||||
this.spring.testConfigLocations("AutowireBeanFactoryObjectPostProcessorTests-aopconfig.xml").autowire();
|
||||
|
||||
MyAdvisedBean bean = this.spring.getContext().getBean(MyAdvisedBean.class);
|
||||
|
|
|
@ -47,7 +47,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
|
||||
// @formatter:off
|
||||
@Override
|
||||
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
protected void configure(AuthenticationManagerBuilder auth) {
|
||||
auth
|
||||
.authenticationProvider(authenticationProvider());
|
||||
}
|
||||
|
|
|
@ -251,7 +251,7 @@ public class GlobalMethodSecurityConfigurationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void multiPermissionEvaluatorConfig() throws Exception {
|
||||
public void multiPermissionEvaluatorConfig() {
|
||||
this.spring.register(MultiPermissionEvaluatorConfig.class).autowire();
|
||||
|
||||
// no exception
|
||||
|
|
|
@ -65,7 +65,7 @@ public class AbstractConfiguredSecurityBuilderTests {
|
|||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
public void getObjectWhenNotBuiltThenThrowIllegalStateException() throws Exception {
|
||||
public void getObjectWhenNotBuiltThenThrowIllegalStateException() {
|
||||
this.builder.getObject();
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ public class AbstractConfiguredSecurityBuilderTests {
|
|||
super(objectPostProcessor, allowConfigurersOfSameType);
|
||||
}
|
||||
|
||||
public Object performBuild() throws Exception {
|
||||
public Object performBuild() {
|
||||
return "success";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public class HttpSecurityHeadersTests {
|
|||
MockMvc mockMvc;
|
||||
|
||||
@Before
|
||||
public void setup() throws Exception {
|
||||
public void setup() {
|
||||
mockMvc = MockMvcBuilders
|
||||
.webAppContextSetup(wac)
|
||||
.addFilters(springSecurityFilterChain)
|
||||
|
@ -86,7 +86,7 @@ public class HttpSecurityHeadersTests {
|
|||
@EnableWebSecurity
|
||||
static class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
protected void configure(HttpSecurity http) {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ public class SampleWebSecurityConfigurerAdapterTests {
|
|||
public static class SampleWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
public void configure(WebSecurity web) throws Exception {
|
||||
public void configure(WebSecurity web) {
|
||||
web
|
||||
.ignoring()
|
||||
.antMatchers("/resources/**");
|
||||
|
@ -367,7 +367,7 @@ public class SampleWebSecurityConfigurerAdapterTests {
|
|||
@Configuration
|
||||
public static class FormLoginWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
|
||||
@Override
|
||||
public void configure(WebSecurity web) throws Exception {
|
||||
public void configure(WebSecurity web) {
|
||||
web
|
||||
.ignoring()
|
||||
.antMatchers("/resources/**");
|
||||
|
|
|
@ -79,7 +79,7 @@ public class WebSecurityConfigurerAdapterPowermockTests {
|
|||
@EnableWebSecurity
|
||||
static class Config extends WebSecurityConfigurerAdapter {
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
protected void configure(HttpSecurity http) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,12 +88,12 @@ public class WebSecurityConfigurerAdapterPowermockTests {
|
|||
boolean configure;
|
||||
|
||||
@Override
|
||||
public void init(HttpSecurity builder) throws Exception {
|
||||
public void init(HttpSecurity builder) {
|
||||
this.init = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(HttpSecurity builder) throws Exception {
|
||||
public void configure(HttpSecurity builder) {
|
||||
this.configure = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ public class WebSecurityConfigurerAdapterTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
protected void configure(HttpSecurity http) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ public class WebSecurityConfigurerAdapterTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
protected void configure(HttpSecurity http) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ public class WebSecurityConfigurerAdapterTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void loadConfigWhenCustomContentNegotiationStrategyBeanThenOverridesDefault() throws Exception {
|
||||
public void loadConfigWhenCustomContentNegotiationStrategyBeanThenOverridesDefault() {
|
||||
OverrideContentNegotiationStrategySharedObjectConfig.CONTENT_NEGOTIATION_STRATEGY_BEAN = mock(ContentNegotiationStrategy.class);
|
||||
this.spring.register(OverrideContentNegotiationStrategySharedObjectConfig.class).autowire();
|
||||
|
||||
|
@ -267,7 +267,7 @@ public class WebSecurityConfigurerAdapterTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void loadConfigWhenDefaultContentNegotiationStrategyThenHeaderContentNegotiationStrategy() throws Exception {
|
||||
public void loadConfigWhenDefaultContentNegotiationStrategyThenHeaderContentNegotiationStrategy() {
|
||||
this.spring.register(ContentNegotiationStrategyDefaultSharedObjectConfig.class).autowire();
|
||||
|
||||
ContentNegotiationStrategyDefaultSharedObjectConfig securityConfig =
|
||||
|
@ -289,7 +289,7 @@ public class WebSecurityConfigurerAdapterTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void loadConfigWhenUserDetailsServiceHasCircularReferenceThenStillLoads() throws Exception {
|
||||
public void loadConfigWhenUserDetailsServiceHasCircularReferenceThenStillLoads() {
|
||||
this.spring.register(RequiresUserDetailsServiceConfig.class, UserDetailsServiceConfig.class).autowire();
|
||||
|
||||
MyFilter myFilter = this.spring.getContext().getBean(MyFilter.class);
|
||||
|
@ -350,7 +350,7 @@ public class WebSecurityConfigurerAdapterTests {
|
|||
|
||||
// SEC-2274: WebSecurityConfigurer adds ApplicationContext as a shared object
|
||||
@Test
|
||||
public void loadConfigWhenSharedObjectsCreatedThenApplicationContextAdded() throws Exception {
|
||||
public void loadConfigWhenSharedObjectsCreatedThenApplicationContextAdded() {
|
||||
this.spring.register(ApplicationContextSharedObjectConfig.class).autowire();
|
||||
|
||||
ApplicationContextSharedObjectConfig securityConfig =
|
||||
|
@ -372,7 +372,7 @@ public class WebSecurityConfigurerAdapterTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void loadConfigWhenCustomAuthenticationTrustResolverBeanThenOverridesDefault() throws Exception {
|
||||
public void loadConfigWhenCustomAuthenticationTrustResolverBeanThenOverridesDefault() {
|
||||
CustomTrustResolverConfig.AUTHENTICATION_TRUST_RESOLVER_BEAN = mock(AuthenticationTrustResolver.class);
|
||||
this.spring.register(CustomTrustResolverConfig.class).autowire();
|
||||
|
||||
|
@ -402,7 +402,7 @@ public class WebSecurityConfigurerAdapterTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void compareOrderWebSecurityConfigurerAdapterWhenLowestOrderToDefaultOrderThenGreaterThanZero() throws Exception {
|
||||
public void compareOrderWebSecurityConfigurerAdapterWhenLowestOrderToDefaultOrderThenGreaterThanZero() {
|
||||
AnnotationAwareOrderComparator comparator = new AnnotationAwareOrderComparator();
|
||||
assertThat(comparator.compare(
|
||||
new LowestPriorityWebSecurityConfig(),
|
||||
|
|
|
@ -56,7 +56,7 @@ public class HttpConfigurationTests {
|
|||
private MockMvc mockMvc;
|
||||
|
||||
@Test
|
||||
public void configureWhenAddFilterUnregisteredThenThrowsBeanCreationException() throws Exception {
|
||||
public void configureWhenAddFilterUnregisteredThenThrowsBeanCreationException() {
|
||||
Throwable thrown = catchThrowable(() -> this.spring.register(UnregisteredFilterConfig.class).autowire() );
|
||||
assertThat(thrown).isInstanceOf(BeanCreationException.class);
|
||||
assertThat(thrown.getMessage()).contains("The Filter class " + UnregisteredFilter.class.getName() +
|
||||
|
@ -67,7 +67,7 @@ public class HttpConfigurationTests {
|
|||
@EnableWebSecurity
|
||||
static class UnregisteredFilterConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
protected void configure(HttpSecurity http) {
|
||||
http
|
||||
.addFilter(new UnregisteredFilter());
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ public class HttpConfigurationTests {
|
|||
static class CasAuthenticationFilterConfig extends WebSecurityConfigurerAdapter {
|
||||
static CasAuthenticationFilter CAS_AUTHENTICATION_FILTER;
|
||||
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
protected void configure(HttpSecurity http) {
|
||||
http
|
||||
.addFilter(CAS_AUTHENTICATION_FILTER);
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ public class NamespaceHttpTests {
|
|||
static AuthenticationManager AUTHENTICATION_MANAGER;
|
||||
|
||||
@Override
|
||||
protected AuthenticationManager authenticationManager() throws Exception {
|
||||
protected AuthenticationManager authenticationManager() {
|
||||
return AUTHENTICATION_MANAGER;
|
||||
}
|
||||
|
||||
|
@ -298,7 +298,7 @@ public class NamespaceHttpTests {
|
|||
@EnableWebSecurity
|
||||
static class JaasApiProvisionConfig extends WebSecurityConfigurerAdapter {
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
protected void configure(HttpSecurity http) {
|
||||
http
|
||||
.addFilter(new JaasApiIntegrationFilter());
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ public class NamespaceHttpTests {
|
|||
}
|
||||
|
||||
@Test // http@request-matcher-ref ant
|
||||
public void configureWhenAntPatternMatchingThenAntPathRequestMatcherUsed() throws Exception {
|
||||
public void configureWhenAntPatternMatchingThenAntPathRequestMatcherUsed() {
|
||||
this.spring.register(RequestMatcherAntConfig.class).autowire();
|
||||
|
||||
FilterChainProxy filterChainProxy = this.spring.getContext().getBean(FilterChainProxy.class);
|
||||
|
@ -340,14 +340,14 @@ public class NamespaceHttpTests {
|
|||
@EnableWebSecurity
|
||||
static class RequestMatcherAntConfig extends WebSecurityConfigurerAdapter {
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
protected void configure(HttpSecurity http) {
|
||||
http
|
||||
.antMatcher("/api/**");
|
||||
}
|
||||
}
|
||||
|
||||
@Test // http@request-matcher-ref regex
|
||||
public void configureWhenRegexPatternMatchingThenRegexRequestMatcherUsed() throws Exception {
|
||||
public void configureWhenRegexPatternMatchingThenRegexRequestMatcherUsed() {
|
||||
this.spring.register(RequestMatcherRegexConfig.class).autowire();
|
||||
|
||||
FilterChainProxy filterChainProxy = this.spring.getContext().getBean(FilterChainProxy.class);
|
||||
|
@ -360,14 +360,14 @@ public class NamespaceHttpTests {
|
|||
@EnableWebSecurity
|
||||
static class RequestMatcherRegexConfig extends WebSecurityConfigurerAdapter {
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
protected void configure(HttpSecurity http) {
|
||||
http
|
||||
.regexMatcher("/regex/.*");
|
||||
}
|
||||
}
|
||||
|
||||
@Test // http@request-matcher-ref
|
||||
public void configureWhenRequestMatcherProvidedThenRequestMatcherUsed() throws Exception {
|
||||
public void configureWhenRequestMatcherProvidedThenRequestMatcherUsed() {
|
||||
this.spring.register(RequestMatcherRefConfig.class).autowire();
|
||||
|
||||
FilterChainProxy filterChainProxy = this.spring.getContext().getBean(FilterChainProxy.class);
|
||||
|
@ -380,7 +380,7 @@ public class NamespaceHttpTests {
|
|||
@EnableWebSecurity
|
||||
static class RequestMatcherRefConfig extends WebSecurityConfigurerAdapter {
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
protected void configure(HttpSecurity http) {
|
||||
http
|
||||
.requestMatcher(new MyRequestMatcher());
|
||||
}
|
||||
|
@ -393,7 +393,7 @@ public class NamespaceHttpTests {
|
|||
}
|
||||
|
||||
@Test // http@security=none
|
||||
public void configureWhenIgnoredAntPatternsThenAntPathRequestMatcherUsedWithNoFilters() throws Exception {
|
||||
public void configureWhenIgnoredAntPatternsThenAntPathRequestMatcherUsedWithNoFilters() {
|
||||
this.spring.register(SecurityNoneConfig.class).autowire();
|
||||
|
||||
FilterChainProxy filterChainProxy = this.spring.getContext().getBean(FilterChainProxy.class);
|
||||
|
@ -415,14 +415,14 @@ public class NamespaceHttpTests {
|
|||
static class SecurityNoneConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
public void configure(WebSecurity web) throws Exception {
|
||||
public void configure(WebSecurity web) {
|
||||
web
|
||||
.ignoring()
|
||||
.antMatchers("/resources/**", "/public/**");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
protected void configure(HttpSecurity http) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -510,7 +510,7 @@ public class NamespaceHttpTests {
|
|||
}
|
||||
|
||||
@Test // http@use-expressions=true
|
||||
public void configureWhenUseExpressionsEnabledThenExpressionBasedSecurityMetadataSource() throws Exception {
|
||||
public void configureWhenUseExpressionsEnabledThenExpressionBasedSecurityMetadataSource() {
|
||||
this.spring.register(UseExpressionsConfig.class).autowire();
|
||||
|
||||
UseExpressionsConfig config = this.spring.getContext().getBean(UseExpressionsConfig.class);
|
||||
|
@ -545,7 +545,7 @@ public class NamespaceHttpTests {
|
|||
}
|
||||
|
||||
@Test // http@use-expressions=false
|
||||
public void configureWhenUseExpressionsDisabledThenDefaultSecurityMetadataSource() throws Exception {
|
||||
public void configureWhenUseExpressionsDisabledThenDefaultSecurityMetadataSource() {
|
||||
this.spring.register(DisableUseExpressionsConfig.class).autowire();
|
||||
|
||||
DisableUseExpressionsConfig config = this.spring.getContext().getBean(DisableUseExpressionsConfig.class);
|
||||
|
|
|
@ -104,7 +104,7 @@ public class WebSecurityTests {
|
|||
@EnableWebMvc
|
||||
static class MvcMatcherConfig extends WebSecurityConfigurerAdapter {
|
||||
@Override
|
||||
public void configure(WebSecurity web) throws Exception {
|
||||
public void configure(WebSecurity web) {
|
||||
// @formatter:off
|
||||
web
|
||||
.ignoring()
|
||||
|
@ -180,7 +180,7 @@ public class WebSecurityTests {
|
|||
@EnableWebMvc
|
||||
static class MvcMatcherServletPathConfig extends WebSecurityConfigurerAdapter {
|
||||
@Override
|
||||
public void configure(WebSecurity web) throws Exception {
|
||||
public void configure(WebSecurity web) {
|
||||
// @formatter:off
|
||||
web
|
||||
.ignoring()
|
||||
|
|
|
@ -51,7 +51,7 @@ public class EnableWebSecurityTests {
|
|||
private MockMvc mockMvc;
|
||||
|
||||
@Test
|
||||
public void configureWhenOverrideAuthenticationManagerBeanThenAuthenticationManagerBeanRegistered() throws Exception {
|
||||
public void configureWhenOverrideAuthenticationManagerBeanThenAuthenticationManagerBeanRegistered() {
|
||||
this.spring.register(SecurityConfig.class).autowire();
|
||||
|
||||
AuthenticationManager authenticationManager = this.spring.getContext().getBean(AuthenticationManager.class);
|
||||
|
@ -85,7 +85,7 @@ public class EnableWebSecurityTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void loadConfigWhenChildConfigExtendsSecurityConfigThenSecurityConfigInherited() throws Exception {
|
||||
public void loadConfigWhenChildConfigExtendsSecurityConfigThenSecurityConfigInherited() {
|
||||
this.spring.register(ChildSecurityConfig.class).autowire();
|
||||
this.spring.getContext().getBean("springSecurityFilterChain", DebugFilter.class);
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ public class EnableWebSecurityTests {
|
|||
@EnableWebMvc
|
||||
static class AuthenticationPrincipalConfig extends WebSecurityConfigurerAdapter {
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
protected void configure(HttpSecurity http) {
|
||||
}
|
||||
|
||||
@RestController
|
||||
|
|
|
@ -133,7 +133,7 @@ public class OAuth2ClientConfigurationTests {
|
|||
static OAuth2AccessTokenResponseClient<OAuth2ClientCredentialsGrantRequest> ACCESS_TOKEN_RESPONSE_CLIENT;
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
protected void configure(HttpSecurity http) {
|
||||
}
|
||||
|
||||
@RestController
|
||||
|
|
|
@ -39,7 +39,7 @@ public class Sec2515Tests {
|
|||
|
||||
// SEC-2515
|
||||
@Test(expected = FatalBeanException.class)
|
||||
public void loadConfigWhenAuthenticationManagerNotConfiguredAndRegisterBeanThenThrowFatalBeanException() throws Exception {
|
||||
public void loadConfigWhenAuthenticationManagerNotConfiguredAndRegisterBeanThenThrowFatalBeanException() {
|
||||
this.spring.register(StackOverflowSecurityConfig.class).autowire();
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class Sec2515Tests {
|
|||
}
|
||||
|
||||
@Test(expected = FatalBeanException.class)
|
||||
public void loadConfigWhenAuthenticationManagerNotConfiguredAndRegisterBeanCustomNameThenThrowFatalBeanException() throws Exception {
|
||||
public void loadConfigWhenAuthenticationManagerNotConfiguredAndRegisterBeanCustomNameThenThrowFatalBeanException() {
|
||||
this.spring.register(CustomBeanNameStackOverflowSecurityConfig.class).autowire();
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class Sec2515Tests {
|
|||
|
||||
// SEC-2549
|
||||
@Test
|
||||
public void loadConfigWhenChildClassLoaderSetThenContextLoads() throws Exception {
|
||||
public void loadConfigWhenChildClassLoaderSetThenContextLoads() {
|
||||
CanLoadWithChildConfig.AUTHENTICATION_MANAGER = mock(AuthenticationManager.class);
|
||||
this.spring.register(CanLoadWithChildConfig.class);
|
||||
AnnotationConfigWebApplicationContext context = (AnnotationConfigWebApplicationContext) this.spring.getContext();
|
||||
|
@ -92,7 +92,7 @@ public class Sec2515Tests {
|
|||
|
||||
// SEC-2515
|
||||
@Test
|
||||
public void loadConfigWhenAuthenticationManagerConfiguredAndRegisterBeanThenContextLoads() throws Exception {
|
||||
public void loadConfigWhenAuthenticationManagerConfiguredAndRegisterBeanThenContextLoads() {
|
||||
this.spring.register(SecurityConfig.class).autowire();
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ public class WebSecurityConfigurationTests {
|
|||
private MockMvc mockMvc;
|
||||
|
||||
@Test
|
||||
public void loadConfigWhenWebSecurityConfigurersHaveOrderThenFilterChainsOrdered() throws Exception {
|
||||
public void loadConfigWhenWebSecurityConfigurersHaveOrderThenFilterChainsOrdered() {
|
||||
this.spring.register(SortedWebSecurityConfigurerAdaptersConfig.class).autowire();
|
||||
|
||||
FilterChainProxy filterChainProxy = this.spring.getContext().getBean(FilterChainProxy.class);
|
||||
|
@ -116,7 +116,7 @@ public class WebSecurityConfigurationTests {
|
|||
@Order(1)
|
||||
static class WebConfigurer1 extends WebSecurityConfigurerAdapter {
|
||||
@Override
|
||||
public void configure(WebSecurity web) throws Exception {
|
||||
public void configure(WebSecurity web) {
|
||||
web
|
||||
.ignoring()
|
||||
.antMatchers("/ignore1", "/ignore2");
|
||||
|
@ -168,7 +168,7 @@ public class WebSecurityConfigurationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void loadConfigWhenWebSecurityConfigurersHaveSameOrderThenThrowBeanCreationException() throws Exception {
|
||||
public void loadConfigWhenWebSecurityConfigurersHaveSameOrderThenThrowBeanCreationException() {
|
||||
Throwable thrown = catchThrowable(() -> this.spring.register(DuplicateOrderConfig.class).autowire());
|
||||
|
||||
assertThat(thrown).isInstanceOf(BeanCreationException.class)
|
||||
|
@ -205,7 +205,7 @@ public class WebSecurityConfigurationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void loadConfigWhenWebInvocationPrivilegeEvaluatorSetThenIsRegistered() throws Exception {
|
||||
public void loadConfigWhenWebInvocationPrivilegeEvaluatorSetThenIsRegistered() {
|
||||
PrivilegeEvaluatorConfigurerAdapterConfig.PRIVILEGE_EVALUATOR = mock(WebInvocationPrivilegeEvaluator.class);
|
||||
|
||||
this.spring.register(PrivilegeEvaluatorConfigurerAdapterConfig.class).autowire();
|
||||
|
@ -219,13 +219,13 @@ public class WebSecurityConfigurationTests {
|
|||
static WebInvocationPrivilegeEvaluator PRIVILEGE_EVALUATOR;
|
||||
|
||||
@Override
|
||||
public void configure(WebSecurity web) throws Exception {
|
||||
public void configure(WebSecurity web) {
|
||||
web.privilegeEvaluator(PRIVILEGE_EVALUATOR);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loadConfigWhenSecurityExpressionHandlerSetThenIsRegistered() throws Exception {
|
||||
public void loadConfigWhenSecurityExpressionHandlerSetThenIsRegistered() {
|
||||
WebSecurityExpressionHandlerConfig.EXPRESSION_HANDLER = mock(SecurityExpressionHandler.class);
|
||||
when(WebSecurityExpressionHandlerConfig.EXPRESSION_HANDLER.getExpressionParser()).thenReturn(mock(ExpressionParser.class));
|
||||
|
||||
|
@ -240,7 +240,7 @@ public class WebSecurityConfigurationTests {
|
|||
static SecurityExpressionHandler EXPRESSION_HANDLER;
|
||||
|
||||
@Override
|
||||
public void configure(WebSecurity web) throws Exception {
|
||||
public void configure(WebSecurity web) {
|
||||
web.expressionHandler(EXPRESSION_HANDLER);
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ public class WebSecurityConfigurationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void loadConfigWhenDefaultSecurityExpressionHandlerThenDefaultIsRegistered() throws Exception {
|
||||
public void loadConfigWhenDefaultSecurityExpressionHandlerThenDefaultIsRegistered() {
|
||||
this.spring.register(WebSecurityExpressionHandlerDefaultsConfig.class).autowire();
|
||||
|
||||
assertThat(this.spring.getContext().getBean(SecurityExpressionHandler.class))
|
||||
|
@ -272,7 +272,7 @@ public class WebSecurityConfigurationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void securityExpressionHandlerWhenPermissionEvaluatorBeanThenPermissionEvaluatorUsed() throws Exception {
|
||||
public void securityExpressionHandlerWhenPermissionEvaluatorBeanThenPermissionEvaluatorUsed() {
|
||||
this.spring.register(WebSecurityExpressionHandlerPermissionEvaluatorBeanConfig.class).autowire();
|
||||
TestingAuthenticationToken authentication = new TestingAuthenticationToken("user", "notused");
|
||||
FilterInvocation invocation = new FilterInvocation(new MockHttpServletRequest("GET", ""), new MockHttpServletResponse(), new MockFilterChain());
|
||||
|
@ -308,7 +308,7 @@ public class WebSecurityConfigurationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void loadConfigWhenDefaultWebInvocationPrivilegeEvaluatorThenDefaultIsRegistered() throws Exception {
|
||||
public void loadConfigWhenDefaultWebInvocationPrivilegeEvaluatorThenDefaultIsRegistered() {
|
||||
this.spring.register(WebInvocationPrivilegeEvaluatorDefaultsConfig.class).autowire();
|
||||
|
||||
assertThat(this.spring.getContext().getBean(WebInvocationPrivilegeEvaluator.class))
|
||||
|
@ -372,7 +372,7 @@ public class WebSecurityConfigurationTests {
|
|||
|
||||
// SEC-2461
|
||||
@Test
|
||||
public void loadConfigWhenMultipleWebSecurityConfigurationThenContextLoads() throws Exception {
|
||||
public void loadConfigWhenMultipleWebSecurityConfigurationThenContextLoads() {
|
||||
this.spring.register(ParentConfig.class).autowire();
|
||||
|
||||
this.child.register(ChildConfig.class);
|
||||
|
@ -400,7 +400,7 @@ public class WebSecurityConfigurationTests {
|
|||
|
||||
// SEC-2773
|
||||
@Test
|
||||
public void getMethodDelegatingApplicationListenerWhenWebSecurityConfigurationThenIsStatic() throws Exception {
|
||||
public void getMethodDelegatingApplicationListenerWhenWebSecurityConfigurationThenIsStatic() {
|
||||
Method method = ClassUtils.getMethod(WebSecurityConfiguration.class, "delegatingApplicationListener", null);
|
||||
assertThat(Modifier.isStatic(method.getModifiers())).isTrue();
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ public class WebSecurityConfigurationTests {
|
|||
@Order(1)
|
||||
static class WebConfigurer1 extends WebSecurityConfigurerAdapter {
|
||||
@Override
|
||||
public void configure(WebSecurity web) throws Exception {
|
||||
public void configure(WebSecurity web) {
|
||||
web
|
||||
.ignoring()
|
||||
.antMatchers("/ignore1", "/ignore2");
|
||||
|
|
|
@ -71,7 +71,7 @@ public class CsrfConfigurerNoWebMvcTests {
|
|||
static class EnableWebConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
protected void configure(HttpSecurity http) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ public class CsrfConfigurerNoWebMvcTests {
|
|||
static class EnableWebMvcConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
protected void configure(HttpSecurity http) {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ public class CsrfConfigurerTests {
|
|||
static class CsrfAppliedDefaultConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
protected void configure(HttpSecurity http) {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ public class FormLoginConfigurerTests {
|
|||
@EnableWebSecurity
|
||||
static class FormLoginConfig extends WebSecurityConfigurerAdapter {
|
||||
@Override
|
||||
public void configure(WebSecurity web) throws Exception {
|
||||
public void configure(WebSecurity web) {
|
||||
// @formatter:off
|
||||
web
|
||||
.ignoring()
|
||||
|
|
|
@ -101,7 +101,7 @@ public class NamespaceHttpCustomFilterTests {
|
|||
super(true);
|
||||
}
|
||||
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
protected void configure(HttpSecurity http) {
|
||||
http
|
||||
// this works so long as the CustomFilter extends one of the standard filters
|
||||
// if not, use addFilterBefore or addFilterAfter
|
||||
|
@ -123,7 +123,7 @@ public class NamespaceHttpCustomFilterTests {
|
|||
super(true);
|
||||
}
|
||||
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
protected void configure(HttpSecurity http) {
|
||||
http
|
||||
.addFilterAt(new OtherCustomFilter(), UsernamePasswordAuthenticationFilter.class);
|
||||
}
|
||||
|
@ -141,8 +141,7 @@ public class NamespaceHttpCustomFilterTests {
|
|||
super(true);
|
||||
}
|
||||
|
||||
protected AuthenticationManager authenticationManager()
|
||||
throws Exception {
|
||||
protected AuthenticationManager authenticationManager() {
|
||||
return new CustomAuthenticationManager();
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public class NamespaceHttpFirewallTests {
|
|||
MockMvc mvc;
|
||||
|
||||
@Test
|
||||
public void requestWhenPathContainsDoubleDotsThenBehaviorMatchesNamespace() throws Exception {
|
||||
public void requestWhenPathContainsDoubleDotsThenBehaviorMatchesNamespace() {
|
||||
this.rule.register(HttpFirewallConfig.class).autowire();
|
||||
assertThatCode(() -> this.mvc.perform(get("/public/../private/")))
|
||||
.isInstanceOf(RequestRejectedException.class);
|
||||
|
@ -69,7 +69,7 @@ public class NamespaceHttpFirewallTests {
|
|||
@EnableWebSecurity
|
||||
static class CustomHttpFirewallConfig extends WebSecurityConfigurerAdapter {
|
||||
@Override
|
||||
public void configure(WebSecurity web) throws Exception {
|
||||
public void configure(WebSecurity web) {
|
||||
web
|
||||
.httpFirewall(new CustomHttpFirewall());
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ public class NamespaceHttpFormLoginTests {
|
|||
static class FormLoginConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
public void configure(WebSecurity web) throws Exception {
|
||||
public void configure(WebSecurity web) {
|
||||
web
|
||||
.ignoring()
|
||||
.antMatchers("/resources/**");
|
||||
|
|
|
@ -81,7 +81,7 @@ public class NamespaceHttpLogoutTests {
|
|||
@EnableWebSecurity
|
||||
static class HttpLogoutConfig extends WebSecurityConfigurerAdapter {
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
protected void configure(HttpSecurity http) {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ public class RememberMeConfigurerTests {
|
|||
MockMvc mvc;
|
||||
|
||||
@Test
|
||||
public void postWhenNoUserDetailsServiceThenException() throws Exception {
|
||||
public void postWhenNoUserDetailsServiceThenException() {
|
||||
this.spring.register(NullUserDetailsConfig.class).autowire();
|
||||
|
||||
assertThatThrownBy(() ->
|
||||
|
@ -103,7 +103,7 @@ public class RememberMeConfigurerTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
protected void configure(AuthenticationManagerBuilder auth) {
|
||||
User user = (User) PasswordEncodedUser.user();
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setUserDetailsService(new InMemoryUserDetailsManager(Collections.singletonList(user)));
|
||||
|
|
|
@ -223,7 +223,7 @@ public class ServletApiConfigurerTests {
|
|||
static AuthenticationTrustResolver TR = spy(AuthenticationTrustResolver.class);
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
protected void configure(HttpSecurity http) {
|
||||
// @formatter:off
|
||||
http
|
||||
.setSharedObject(AuthenticationTrustResolver.class, TR);
|
||||
|
|
|
@ -476,7 +476,7 @@ public class SessionManagementConfigurerTests {
|
|||
static AuthenticationTrustResolver TR;
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
protected void configure(HttpSecurity http) {
|
||||
// @formatter:off
|
||||
http
|
||||
.setSharedObject(AuthenticationTrustResolver.class, TR);
|
||||
|
|
|
@ -76,7 +76,7 @@ public class SessionManagementConfigurerTransientAuthenticationTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
protected void configure(AuthenticationManagerBuilder auth) {
|
||||
auth
|
||||
.authenticationProvider(new TransientAuthenticationProvider());
|
||||
}
|
||||
|
|
|
@ -1170,7 +1170,7 @@ public class OAuth2ResourceServerConfigurerTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void configureWhenOnlyIntrospectionUrlThenException() throws Exception {
|
||||
public void configureWhenOnlyIntrospectionUrlThenException() {
|
||||
assertThatCode(() -> this.spring.register(OpaqueTokenHalfConfiguredConfig.class).autowire())
|
||||
.isInstanceOf(BeanCreationException.class);
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ public class AbstractSecurityWebSocketMessageBrokerConfigurerTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void addsAuthenticationPrincipalResolver() throws InterruptedException {
|
||||
public void addsAuthenticationPrincipalResolver() {
|
||||
loadConfig(SockJsSecurityConfig.class);
|
||||
|
||||
MessageChannel messageChannel = clientInboundChannel();
|
||||
|
@ -146,8 +146,7 @@ public class AbstractSecurityWebSocketMessageBrokerConfigurerTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void addsAuthenticationPrincipalResolverWhenNoAuthorization()
|
||||
throws InterruptedException {
|
||||
public void addsAuthenticationPrincipalResolverWhenNoAuthorization() {
|
||||
loadConfig(NoInboundSecurityConfig.class);
|
||||
|
||||
MessageChannel messageChannel = clientInboundChannel();
|
||||
|
@ -159,7 +158,7 @@ public class AbstractSecurityWebSocketMessageBrokerConfigurerTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void addsCsrfProtectionWhenNoAuthorization() throws InterruptedException {
|
||||
public void addsCsrfProtectionWhenNoAuthorization() {
|
||||
loadConfig(NoInboundSecurityConfig.class);
|
||||
|
||||
SimpMessageHeaderAccessor headers = SimpMessageHeaderAccessor
|
||||
|
@ -177,7 +176,7 @@ public class AbstractSecurityWebSocketMessageBrokerConfigurerTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void csrfProtectionForConnect() throws InterruptedException {
|
||||
public void csrfProtectionForConnect() {
|
||||
loadConfig(SockJsSecurityConfig.class);
|
||||
|
||||
SimpMessageHeaderAccessor headers = SimpMessageHeaderAccessor
|
||||
|
@ -195,7 +194,7 @@ public class AbstractSecurityWebSocketMessageBrokerConfigurerTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void csrfProtectionDisabledForConnect() throws InterruptedException {
|
||||
public void csrfProtectionDisabledForConnect() {
|
||||
loadConfig(CsrfDisabledSockJsSecurityConfig.class);
|
||||
|
||||
SimpMessageHeaderAccessor headers = SimpMessageHeaderAccessor
|
||||
|
@ -265,8 +264,7 @@ public class AbstractSecurityWebSocketMessageBrokerConfigurerTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void msmsRegistryCustomPatternMatcher()
|
||||
throws Exception {
|
||||
public void msmsRegistryCustomPatternMatcher() {
|
||||
loadConfig(MsmsRegistryCustomPatternMatcherConfig.class);
|
||||
|
||||
clientInboundChannel().send(message("/app/a.b"));
|
||||
|
@ -317,8 +315,7 @@ public class AbstractSecurityWebSocketMessageBrokerConfigurerTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void overrideMsmsRegistryCustomPatternMatcher()
|
||||
throws Exception {
|
||||
public void overrideMsmsRegistryCustomPatternMatcher() {
|
||||
loadConfig(OverrideMsmsRegistryCustomPatternMatcherConfig.class);
|
||||
|
||||
clientInboundChannel().send(message("/app/a/b"));
|
||||
|
@ -371,8 +368,7 @@ public class AbstractSecurityWebSocketMessageBrokerConfigurerTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void defaultPatternMatcher()
|
||||
throws Exception {
|
||||
public void defaultPatternMatcher() {
|
||||
loadConfig(DefaultPatternMatcherConfig.class);
|
||||
|
||||
clientInboundChannel().send(message("/app/a/b"));
|
||||
|
@ -422,8 +418,7 @@ public class AbstractSecurityWebSocketMessageBrokerConfigurerTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void customExpression()
|
||||
throws Exception {
|
||||
public void customExpression() {
|
||||
loadConfig(CustomExpressionConfig.class);
|
||||
|
||||
clientInboundChannel().send(message("/denyRob"));
|
||||
|
@ -612,8 +607,7 @@ public class AbstractSecurityWebSocketMessageBrokerConfigurerTests {
|
|||
return parameter.getParameterType().isAssignableFrom(MyCustomArgument.class);
|
||||
}
|
||||
|
||||
public Object resolveArgument(MethodParameter parameter, Message<?> message)
|
||||
throws Exception {
|
||||
public Object resolveArgument(MethodParameter parameter, Message<?> message) {
|
||||
return new MyCustomArgument("");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class AuthenticationManagerBeanDefinitionParserTests {
|
|||
|
||||
@Test
|
||||
// SEC-1225
|
||||
public void providersAreRegisteredAsTopLevelBeans() throws Exception {
|
||||
public void providersAreRegisteredAsTopLevelBeans() {
|
||||
ConfigurableApplicationContext context = this.spring.context(CONTEXT)
|
||||
.getContext();
|
||||
assertThat(context.getBeansOfType(AuthenticationProvider.class)).hasSize(1);
|
||||
|
@ -78,7 +78,7 @@ public class AuthenticationManagerBeanDefinitionParserTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void credentialsAreClearedByDefault() throws Exception {
|
||||
public void credentialsAreClearedByDefault() {
|
||||
ConfigurableApplicationContext appContext = this.spring.context(CONTEXT)
|
||||
.getContext();
|
||||
ProviderManager pm = (ProviderManager) appContext
|
||||
|
@ -87,7 +87,7 @@ public class AuthenticationManagerBeanDefinitionParserTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void clearCredentialsPropertyIsRespected() throws Exception {
|
||||
public void clearCredentialsPropertyIsRespected() {
|
||||
ConfigurableApplicationContext appContext = this.spring.context("<authentication-manager erase-credentials='false'/>")
|
||||
.getContext();
|
||||
ProviderManager pm = (ProviderManager) appContext
|
||||
|
|
|
@ -57,7 +57,7 @@ public class AuthenticationProviderBeanDefinitionParserTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void externalUserServiceRefWorks() throws Exception {
|
||||
public void externalUserServiceRefWorks() {
|
||||
appContext = new InMemoryXmlApplicationContext(
|
||||
" <authentication-manager>"
|
||||
+ " <authentication-provider user-service-ref='myUserService' />"
|
||||
|
@ -69,7 +69,7 @@ public class AuthenticationProviderBeanDefinitionParserTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void providerWithBCryptPasswordEncoderWorks() throws Exception {
|
||||
public void providerWithBCryptPasswordEncoderWorks() {
|
||||
setContext(" <authentication-provider>"
|
||||
+ " <password-encoder hash='bcrypt'/>"
|
||||
+ " <user-service>"
|
||||
|
@ -80,7 +80,7 @@ public class AuthenticationProviderBeanDefinitionParserTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void providerWithMd5PasswordEncoderWorks() throws Exception {
|
||||
public void providerWithMd5PasswordEncoderWorks() {
|
||||
appContext = new InMemoryXmlApplicationContext(
|
||||
" <authentication-manager>"
|
||||
+ " <authentication-provider>"
|
||||
|
@ -99,7 +99,7 @@ public class AuthenticationProviderBeanDefinitionParserTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void providerWithShaPasswordEncoderWorks() throws Exception {
|
||||
public void providerWithShaPasswordEncoderWorks() {
|
||||
appContext = new InMemoryXmlApplicationContext(
|
||||
" <authentication-manager>"
|
||||
+ " <authentication-provider>"
|
||||
|
@ -116,7 +116,7 @@ public class AuthenticationProviderBeanDefinitionParserTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void passwordIsBase64EncodedWhenBase64IsEnabled() throws Exception {
|
||||
public void passwordIsBase64EncodedWhenBase64IsEnabled() {
|
||||
appContext = new InMemoryXmlApplicationContext(
|
||||
" <authentication-manager>"
|
||||
+ " <authentication-provider>"
|
||||
|
@ -137,7 +137,7 @@ public class AuthenticationProviderBeanDefinitionParserTests {
|
|||
|
||||
// SEC-1466
|
||||
@Test(expected = BeanDefinitionParsingException.class)
|
||||
public void exernalProviderDoesNotSupportChildElements() throws Exception {
|
||||
public void exernalProviderDoesNotSupportChildElements() {
|
||||
appContext = new InMemoryXmlApplicationContext(
|
||||
" <authentication-manager>"
|
||||
+ " <authentication-provider ref='aProvider'> "
|
||||
|
|
|
@ -61,7 +61,7 @@ public class JdbcUserServiceBeanDefinitionParserTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void beanNameIsCorrect() throws Exception {
|
||||
public void beanNameIsCorrect() {
|
||||
assertThat(JdbcUserDetailsManager.class.getName()).isEqualTo(
|
||||
new JdbcUserServiceBeanDefinitionParser()
|
||||
.getBeanClassName(mock(Element.class)));
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue