-
Notifications
You must be signed in to change notification settings - Fork 229
Address review feedback on PR #1214 (Spring Boot 4 compat) #1215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3a140c3
fix: re-add SecurityAutoConfigurationExcluder updated for Spring Boot 4
jamesfredley 73079f2
docs: address PR #1214 review feedback on documentation and attribution
jamesfredley a871b56
style(test): use g:submitButton in testRole/edit and testRequestmap/e…
jamesfredley a031654
fix: extend SecurityAutoConfigurationExcluder for SB4 modules and har…
jamesfredley c2e684b
test: tighten SecurityAutoConfigurationExcluder integration assertions
jamesfredley 79b0e2b
fix(build): add jline-reader compileOnly dependency to fix CI
jamesfredley dbb62e8
fix(build): manage jline-reader version via gradle.properties + cover…
jamesfredley 1282c5c
docs: document coexistence with component-based Spring Security confi…
jamesfredley 3589ed6
test: type integration spec field as ConfigurableApplicationContext
jamesfredley e218158
feat(componentbased): blend Grails plugin config with component-based…
jamesfredley fbc7f8a
fix(componentbased): add per-UDS DaoAuthenticationProvider instead of…
jamesfredley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
...oovy/grails/plugin/springsecurity/SecurityAutoConfigurationExcluderIntegrationSpec.groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package grails.plugin.springsecurity | ||
|
|
||
| import spock.lang.Specification | ||
|
|
||
| import org.springframework.beans.factory.annotation.Autowired | ||
| import org.springframework.beans.factory.config.ConfigurableListableBeanFactory | ||
| import org.springframework.context.ConfigurableApplicationContext | ||
| import org.springframework.security.core.userdetails.UserDetailsService | ||
| import org.springframework.security.web.SecurityFilterChain | ||
|
|
||
| import grails.testing.mixin.integration.Integration | ||
|
|
||
| @Integration | ||
| class SecurityAutoConfigurationExcluderIntegrationSpec extends Specification { | ||
|
|
||
| @Autowired | ||
| ConfigurableApplicationContext applicationContext | ||
|
|
||
| void "SecurityAutoConfigurationExcluder class is on the classpath"() { | ||
| expect: | ||
| Class.forName( | ||
| 'grails.plugin.springsecurity.SecurityAutoConfigurationExcluder' | ||
| ) | ||
| } | ||
|
|
||
| void "no Spring Boot SecurityFilterChain bean is registered alongside the plugin"() { | ||
| given: 'the application context bean factory' | ||
| ConfigurableListableBeanFactory beanFactory = applicationContext.beanFactory | ||
|
|
||
| and: 'all SecurityFilterChain beans visible to the application context' | ||
| def filterChainBeans = applicationContext.getBeanNamesForType(SecurityFilterChain) | ||
|
|
||
| expect: 'none come from Spring Boot security auto-configurations' | ||
| filterChainBeans.every { name -> | ||
| !beanFactory.getBeanDefinition(name).beanClassName?.startsWith('org.springframework.boot.security.') | ||
| } | ||
|
|
||
| and: 'none of the excluded auto-configuration class names are registered as beans' | ||
| SecurityAutoConfigurationExcluder.excludedAutoConfigurations.each { className -> | ||
| assert !beanFactory.containsBeanDefinition(className) : | ||
| "Spring Boot auto-configuration ${className} should be excluded by SecurityAutoConfigurationExcluder" | ||
| } | ||
|
jamesfredley marked this conversation as resolved.
|
||
| } | ||
|
|
||
| void "no Spring Boot in-memory UserDetailsService is registered alongside the plugin"() { | ||
| given: 'the application context bean factory' | ||
| ConfigurableListableBeanFactory beanFactory = applicationContext.beanFactory | ||
|
|
||
| and: 'all UserDetailsService beans visible to the application context' | ||
| def udsBeans = applicationContext.getBeanNamesForType(UserDetailsService) | ||
|
|
||
| expect: 'at least one (the plugin one) exists' | ||
| udsBeans.length >= 1 | ||
|
|
||
| and: 'none come from Spring Boot security auto-configurations' | ||
| udsBeans.every { name -> | ||
| !beanFactory.getBeanDefinition(name).beanClassName?.startsWith('org.springframework.boot.security.') | ||
| } | ||
|
|
||
| and: "Boot's in-memory UserDetailsService is not present" | ||
| !udsBeans.any { it == 'inMemoryUserDetailsManager' } | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.