Jeff
Jeff

Reputation: 1601

How does Spring work with apparently no code?

I am trying to understand the example described here.

What is puzzling to me is that there is apparently no code. I run the spring-security-samples-insecuremvc-3.2.x within Tomcat and a form is presented to interact with but there is no Java code whatsoever as far as I can see. I can't even find the form. I realize that the code must be in one of the dependencies but I am baffled at how this all works.

Upvotes: 1

Views: 79

Answers (3)

LWK69
LWK69

Reputation: 1080

I have been looking at this sample today with the same questions as you - where the heck is the source? I finally found the answer I think you're looking for. Take a look at the pom.xml and in the dependencies you'll see spring-security-samples-messages-jc. Assuming you downloaded all the samples, import that project into STS and you'll find the files you're looking for.

BTW, I've been following the instructions on the spring security website to add security to this sample and I have not yet been able to get it to work - the login screen does not appear. Let me know if you have better luck than me.

Upvotes: 1

Neil McGuigan
Neil McGuigan

Reputation: 48267

The default spring security login form is generated by the class org.springframework.security.web.ui.DefaultLoginPageGeneratingFilter which is in spring-security-web-$version.jar

The method is generateLoginPageHtml()

Upvotes: 0

Marcel Stör
Marcel Stör

Reputation: 23565

Spring does generate/provide a default login form if it's configured to do form-based login and no custom login form is configured.

Sidenote: how to create and configure a custom login form is, for example, explained here: http://docs.spring.io/spring-security/site/docs/3.2.x/guides/form.html (to long to be copy/pasted here).

Upvotes: 1

Related Questions