spring-securityspring-roogvnix

Spring Roo + gvNIX + Typical Security Change welcome page to index.jspx when not logged in


I want to display a general home page (index.jspx) when someone visits my site. This site is build with Spring Roo / gvNIX and using Typical security.

Default however, as long as a user is not logged in, the login.jspx page is shown and not the index.jspx page, see illustration with the Petclinic site, https://petclinic-gvnix.rhcloud.com.

When visiting my site I want to welcome a user with welcome and some general information.

I will illustrate my question with the sample gvNIX Petclinic application. When you go to this site with https://petclinic-gvnix.rhcloud.com you get will be reat https://petclinic-gvnix.rhcloud.com/login

After logging in you get at the main page: https://petclinic-gvnix.rhcloud.com. Actually this is index.jspx.

Seems simple, yet could not find an answer.

Changes I made, without effect are:

views.xml

Changed the definition extends="default" to definition extends="public"

<definition extends="public" name="index">
    <put-attribute name="body" value="/WEB-INF/views/index.jspx" />
</definition>

Added to web.xml

<!-- Index -->
<welcome-file-list>
    <welcome-file>index</welcome-file>
</welcome-file-list>

Added to applicationContext-security.xml the following

    <intercept-url access="permitAll" pattern="/index/**" />
    <intercept-url access="permitAll" pattern="/login/**" />

Yet it still first goes to the login page.

Question

  1. How can I have the index.jspx page to be the default home page, also when a user is not logged in.
  2. Where can I read / get more info on how this works?

I read the "Spring in Action" from Ken Rimple and Googled


Solution

  • Try to add root to url list:

    <intercept-url access="permitAll" pattern="/" />
    <intercept-url access="permitAll" pattern="/login/**" />
    

    and revert the other changes

    You must take account that you are define rules for urls and you can permit access just to a single page.

    Also assure that user can access to /resources/**.

    Good luck!