Skip to content

Add sample CAS app with java configuration #121

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

Closed
wants to merge 6 commits into from

Conversation

hdeadman
Copy link

This sample app lets you run ./gradlew :servlet:java-configuration:cas:login:appRun and then login and logout using spring security and a remote test CAS server (run by the CAS project). I don't know how clean it is, but it works. After some cleanup it could be used to make the Java annotations in the CAS documentation. (spring-projects/spring-security#12691)

I had to run it against locally built Spring Security 6.1-SNAPSHOT since CAS support isn't merged into main branch yet (./gradlew clean build publishToMavenLocal -x checkFormat -x javadoc on spring-security with this PR - spring-projects/spring-security#12362)

@marcusdacoregio
Copy link
Contributor

Hi @hdeadman, thanks for the PR.

Can the install-cas.sh script be replaced with a docker image that starts a local server?

@marcusdacoregio marcusdacoregio self-assigned this Feb 24, 2023
@marcusdacoregio marcusdacoregio added the enhancement New feature or request label Feb 24, 2023
@hdeadman
Copy link
Author

Although there is a CAS docker image that would probably work for this sample, any pre-built CAS docker image would be a bad starting point for someone getting familiar with CAS. CAS has so many modules to choose from when building a CAS server that you really have to start with a CAS overlay (using CAS initializr) and then you can build a custom image using Gradle Jib. I could use the overlay to build a docker image and then run the CAS server with Docker, but I think just pulling the apereo/cas:6.6.6 or apereo/cas:latest image would be a disservice to someone new to CAS since start with the image is a dead end. If the purpose of this is just to focus on the spring-security-cas client aspect and make the script to start the CAS server as simple as possible then I can probably do the same server using the default image. I will probably try it tomorrow.

@hdeadman
Copy link
Author

hdeadman commented Mar 1, 2023

I added another script that runs the server with Docker. I didn't remove the other script but I can if you would prefer it not be there.

@marcusdacoregio
Copy link
Contributor

Hi @hdeadman.

I decided to push a Spring Boot CAS sample for now because I had trouble creating integration tests for this Java Configuration sample. If you can make the tests work like the other sample it would be nice, otherwise, it might take a while for me to put this back on my priority list.

I think we can stick with the Spring Boot sample for now since the beans configuration is pretty much the same and maybe reopen this PR if there is some specific need for Java Configuration. What do you say?

@hdeadman
Copy link
Author

hdeadman commented Mar 6, 2023

I think your spring boot example is sufficient, I was copying config from a spring boot app when I did the java config example so not sure there is much difference (and people not using spring boot can probably figure out and differences).

@hdeadman hdeadman closed this Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants