-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1015 from bkoehm/bkoehm.7.0.x
Grails 7
- Loading branch information
Showing
65 changed files
with
418 additions
and
185 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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
151 changes: 151 additions & 0 deletions
151
...ctional-test-app/src/integration-test/groovy/specs/BasicAuthCacheUsersSecuritySpec.groovy
This file contains 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,151 @@ | ||
package specs | ||
|
||
import org.springframework.security.core.userdetails.UserCache | ||
import pages.LoginPage | ||
import pages.role.CreateRolePage | ||
import pages.role.ListRolePage | ||
import pages.role.ShowRolePage | ||
import pages.user.CreateUserPage | ||
import pages.user.ListUserPage | ||
import pages.user.ShowUserPage | ||
import spock.lang.IgnoreIf | ||
|
||
@IgnoreIf({ System.getProperty('TESTCONFIG') != 'basicCacheUsers' }) | ||
class BasicAuthCacheUsersSecuritySpec extends AbstractSecuritySpec { | ||
|
||
private HttpURLConnection connection | ||
UserCache userCache | ||
|
||
void 'create roles'() { | ||
when: | ||
to ListRolePage | ||
|
||
then: | ||
roleRows.size() == 0 | ||
|
||
when: | ||
newRoleButton.click() | ||
|
||
then: | ||
at CreateRolePage | ||
|
||
when: | ||
authority = 'ROLE_ADMIN' | ||
createButton.click() | ||
|
||
then: | ||
at ShowRolePage | ||
|
||
when: | ||
to ListRolePage | ||
|
||
then: | ||
roleRows.size() == 1 | ||
|
||
when: | ||
newRoleButton.click() | ||
|
||
then: | ||
at CreateRolePage | ||
|
||
when: | ||
authority = 'ROLE_ADMIN2' | ||
createButton.click() | ||
|
||
then: | ||
at ShowRolePage | ||
|
||
when: | ||
to ListRolePage | ||
|
||
then: | ||
roleRows.size() == 2 | ||
} | ||
|
||
void 'create users'() { | ||
when: | ||
to ListUserPage | ||
|
||
then: | ||
userRows.size() == 0 | ||
|
||
when: | ||
newUserButton.click() | ||
|
||
then: | ||
at CreateUserPage | ||
|
||
when: | ||
username = 'admin1' | ||
password = 'password1' | ||
$('#enabled').click() | ||
$('#ROLE_ADMIN').click() | ||
createButton.click() | ||
|
||
then: | ||
at ShowUserPage | ||
|
||
when: | ||
to ListUserPage | ||
|
||
then: | ||
userRows.size() == 1 | ||
|
||
when: | ||
newUserButton.click() | ||
|
||
then: | ||
at CreateUserPage | ||
|
||
when: | ||
username = 'admin2' | ||
password = 'password2' | ||
$('#enabled').click() | ||
$('#ROLE_ADMIN').click() | ||
$('#ROLE_ADMIN2').click() | ||
createButton.click() | ||
|
||
then: | ||
at ShowUserPage | ||
|
||
when: | ||
to ListUserPage | ||
|
||
then: | ||
userRows.size() == 2 | ||
} | ||
|
||
@IgnoreIf({ !System.getProperty('geb.env') }) | ||
void 'check userDetails caching'() { | ||
|
||
when: | ||
go 'secureAnnotated' | ||
|
||
then: | ||
at LoginPage | ||
|
||
when: | ||
login 'admin1', 'password1' | ||
|
||
then: | ||
assertContentContains 'you have ROLE_ADMIN' | ||
|
||
and: | ||
userCache.getUserFromCache('admin1') | ||
|
||
cleanup: | ||
logout() | ||
} | ||
|
||
protected void logout() { | ||
super.logout() | ||
// cheesy, but the 'Authentication' header from basic auth | ||
// isn't cleared, so this forces an invalid header | ||
getWithAuth '', 'not_a_valid_username', '' | ||
} | ||
|
||
private void getWithAuth(String path, String username, String password) { | ||
String uri = new URI(baseUrlRequired).resolve(new URI(path)) | ||
go uri.replace('http://', 'http://' + username + ':' + password + '@') | ||
} | ||
} |
This file contains 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 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 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 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 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 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 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
4 changes: 2 additions & 2 deletions
4
examples/integration-test-app/src/main/groovy/com/test/AdditionalLogoutHandler.groovy
This file contains 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 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 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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
configurations.configureEach { | ||
resolutionStrategy.eachDependency { DependencyResolveDetails details -> | ||
if (details.requested.group == 'org.codehaus.groovy') { | ||
if ((details.requested.group == 'org.codehaus.groovy' || details.requested.group == 'org.apache.groovy') && details.requested.name != 'groovy-bom') { | ||
String groovyVersion = findProperty('groovyVersion') ?: libs.versions.groovy.get() | ||
details.useVersion(groovyVersion) | ||
details.useTarget(group: 'org.apache.groovy', name: details.requested.name, version: groovyVersion) | ||
details.because "The dependency coordinates are changed in Apache Groovy 4, plus ensure version" | ||
} | ||
} | ||
} |
This file contains 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
java { | ||
sourceCompatibility = JavaVersion.VERSION_11 | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
withJavadocJar() | ||
withSourcesJar() | ||
} |
Oops, something went wrong.