grails 3 spring security boot starter login page customization - spring

Is it possible to customize the login gsp page for the starter security plugin?
org.springframework.boot:spring-boot-starter-security
I read about adding grails-app/views/login/auth.gsp but that made no difference.

If you are using Grails 3, then you probably would find it easier to use the Grails plugin, rather than trying to use the spring boot starter directly. In your gradle build, put:
compile 'org.grails.plugins:spring-security-core:<version>'
If you run the provided starter script, then the necessary grails config values will be placed in application.groovy for you to adjust to your needs. The docs for the plugin are quite good: https://grails-plugins.github.io/grails-spring-security-core/, and once you see how the plugin works, the Spring documentation becomes easier to use in the context of Grails (for example, all the spring bean config you might want to do based on Spring's docs you do in grails-app/conf/spring/resources.groovy using the bean builder DSL.
If you use this plugin then all the spring wiring will be done for you, and the override of the login page's gsp should work as advertised.
If you don't want to use the Grails plugin, then perhaps looking at the source for the plugin will give you the information you need to wire in the spring package yourself (since that's what the plugin does). Most of the spring wiring work takes place right in the plugin file SpringSecurityCoreGrailsPlugin.groovy

Related

what does "spring-kafka without springboot" mean

I'm totally new to Kafka and terribly confused by this:
https://docs.spring.io/spring-kafka/reference/html/#with-java-configuration-no-spring-boot
I don't understand what that even means. What does "no spring boot mean" because that example sure as hell uses spring boot. I'm so confused....
EDIT
if I'm using SpringBoot and spring-kafka, should I have to manually create #Bean ConcurrentKafkaListenerContainerFactory as shown here. Most of the examples in the docs for setting up filtering / config / etc seem to use the "manual" configuration using #Bean. Is that "normal"? The docs are very confusing to me...especially this warning:
Spring for Apache Kafka is designed to be used in a Spring Application Context. For example, if you create the listener container yourself outside of a Spring context, not all functions will work unless you satisfy all of the …​Aware interfaces that the container implements.
It's referring to the autowired configuration, as compared to putting each property in the config via HashMap/Properties in-code.
Also, it does not use #SpringBootApplication or SpringApplication.run, it just calls a regular main method using a hard-coded Config class.
Spring boot contains the functionality of AutoConfiguration
What this means is that spring boot when discovers some specific jar dependencies it knows, in the project, it automatically configures them to work on a basic level. This does not exist in simple Spring project where even if you add the dependency you have to also provide the configuration as to how it should work in your application.
This is also happening here with dependencies of Kafka. Therefore the documentation explains what more you have to configure if you don't have spring-boot with auto-configuration to make kafka work in a spring project.
Another question asked in comment is what happens in case you want some complex custom configuration instead of the automatic configuration provided while you are in a spring-boot app.
As documented
Auto-configuration tries to be as intelligent as possible and will
back-away as you define more of your own configuration. You can always
manually exclude() any configuration that you never want to apply (use
excludeName() if you don't have access to them). You can also exclude
them via the spring.autoconfigure.exclude property.
So if you want to have some complex configuration which is not automatically provided by spring-boot through some other mechanism like a spring-boot specific application property, then you can make your own configuration with your custom bean and then either automatic configuration from spring-boot for that class will back of as spring does several intelligent checks during application context set up or you will have to exclude the class from auto configuration manually.
In that case you could probably take as an example reference of how to register manually your complex configurations in spring boot what is documented on how to be done in non spring boot app. doc

adding spring-data-rest ontop of spring-data-jpa

i created a maven project, and added all dependencies i need.
i have some repositories using the spring-data-jpa, and i added some integration tests.
now i need to add ontop of it spring-data-rest, if i understand it is based on springmvc.
but all examples i found, i need to add spring boot to start the app.
i noticed also all new spring projects use spring boot.
this means that i have to learn and use it for my projects?
how can i use spring-data-jpa+spring-data-jpa with an existing servlet3 project
The reason all examples are written using Boot is that Boot is indeed the way you should start a new Spring project these days. It free's from a lot of the tedious work of setting up the infrastructure, finding dependencies in the right version etc.
To use Spring Data REST without Boot, simply add the necessary dependencies to your project. The easiest way to do this is to use the Spring Data Release Train BOM (which will help you pulling in the correct matching versions) along side the version-less dependency declarations for Spring Data REST WebMVC and - in your case - Spring Data JPA.
Then go ahead and either register RepositoryRestMvcConvfiguration as Spring bean (either through XML configuration or JavaConfig).
All of this is also documented in the reference documentation.

Struts2+Spring3+Tiles3

I would like to integrate tiles 3 to my web application spring3+struts2+hibernate,
but I don't have any idea of were to begin. All examples that I see use struts2 with tiles only, no integration of spring.
Here are few inputs how to integrate it.
For Integrating Struts2 with Spring use struts2-Spring plugin, all you need to have required spring jars and plugin, and your spring configuration file.Plugin document contains a basic start as how to configure it and how to use it, just follow those instructions and you are good to go (i am assuming you know how to use Spring )
Struts2 is independent of Hibernate and you are free to use it on your own way, though there are some plugins available , but i will suggest not to use them
For tiles there is again a plugin to take care of integration.
All these plugin will help you to integrate various technologies, but how to use them and how they work, you need to get know about them independently.

Spring Security without spring core?

I have a really simple question, that I just can't find the answer.
If I want to use only Spring Security, do I need Spring core or any other dependency?
In this link, in the bottom I see only spring security jars as dependencies, but still I couldn't get it to work. I only got it to work when I used a lot more of spring jars (core, context, and more).
So, what are the minimal dependencies I need for using Spring Security? All I need is an authorization and authentication framework, and I want as little dependencies as possible.
Thank you!
For every spring extension you need to use Srping core, because every extension is build on top of spring core

Using the Spring Security plugin with Grails without the domain model

We're using Grails but with an existing model layer and DAO layer. We have an app written already in Spring MVC, using Spring for IoC and also Security. I'm trying to port the control and view over to Grails as a proof of concept. I have Grails working fine with IoC but am having some trouble getting Grails to work with Spring Security. I'm using 0.5.1 of the Spring security plugin for grails. I have an xml file with all of the spring security settings that work fine with the Spring MVC app, but I'm having trouble getting it to work in Grails. If anyone has any experience using Grails with Spring Security but not using the domain part of the Spring security plugin, then please let me know. Any advice, websites etc would be helpful.
You don't even need the Grails Spring Security Plugin,
You can integrate Spring Security 3 right into Grails as
it all Spring under the hood any way.
You only have to place the Security jars in the lib folder, add two entries into the web.xml and copy over your security applictionContext
This way you can use your existing Spring Security in your grails project
This worked for me.
http://old.nabble.com/Baked-Beans%3A-Securing-Grails-with-Spring-Security-3!-td25339938.html#a25339938
http://blog.jayway.com/2009/11/23/spring-security-for-real-with-grails/comment-page-1
http://knol.google.com/k/grails-with-spring-security#

Resources