Welcome page support and security redirections
This commit is contained in:
parent
6f0b83aaab
commit
519a9c7e45
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
target/
|
target/
|
||||||
|
.settings/
|
||||||
*~
|
*~
|
||||||
|
|
||||||
|
|
|
@ -19,4 +19,4 @@ spring.jpa.database-platform=org.sqlite.hibernate.dialect.SQLiteDialect
|
||||||
#spring.jpa.show-sql: true
|
#spring.jpa.show-sql: true
|
||||||
|
|
||||||
# My special properties
|
# My special properties
|
||||||
gourmet.password.file=.gourmetpw
|
gourmet.password.file=${user.home}/.gourmetpw
|
||||||
|
|
|
@ -34,8 +34,13 @@ public class SpringSecurityConfig
|
||||||
// require all requests to be authenticated except
|
// require all requests to be authenticated except
|
||||||
// for the resources
|
// for the resources
|
||||||
http.authorizeRequests()
|
http.authorizeRequests()
|
||||||
.antMatchers("/javax.faces.resource/**", "/main.jsf",
|
.antMatchers("/javax.faces.resource/**",
|
||||||
"/img/**", "/recipeDetails.jsf")
|
"/",
|
||||||
|
"/index.jsf",
|
||||||
|
"/main.jsf",
|
||||||
|
"/img/**",
|
||||||
|
"/recipeDetails.jsf",
|
||||||
|
"/recipePrint.jsf")
|
||||||
.permitAll().anyRequest().authenticated();
|
.permitAll().anyRequest().authenticated();
|
||||||
// login
|
// login
|
||||||
http.formLogin()// .loginPage("/login.xhtml")
|
http.formLogin()// .loginPage("/login.xhtml")
|
||||||
|
|
|
@ -204,9 +204,14 @@ public class UserSession implements Serializable {
|
||||||
|
|
||||||
public String logoutAction() {
|
public String logoutAction() {
|
||||||
log.warn("Session Idle listener logout");
|
log.warn("Session Idle listener logout");
|
||||||
return "/main.jsf";
|
return goHome();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String goHome() {
|
||||||
|
log.warn("E.T. Go Home!");
|
||||||
|
return "/main.jsf?faces-redirect=true";
|
||||||
|
}
|
||||||
|
|
||||||
public List<Recipe> getShoppingList() {
|
public List<Recipe> getShoppingList() {
|
||||||
return this.shoppingList ;
|
return this.shoppingList ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.mousetech.gourmetj;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.core.Ordered;
|
||||||
|
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class WelcomePageRedirect implements WebMvcConfigurer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addViewControllers(ViewControllerRegistry registry) {
|
||||||
|
registry.addViewController("/")
|
||||||
|
.setViewName("forward:/index.xhtml");
|
||||||
|
registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,10 +8,13 @@
|
||||||
>
|
>
|
||||||
<name>GourmetJ</name>
|
<name>GourmetJ</name>
|
||||||
<navigation-rule>
|
<navigation-rule>
|
||||||
|
<description>Global Navigation</description>
|
||||||
|
<display-name>Navigation</display-name>
|
||||||
<from-view-id>/*</from-view-id>
|
<from-view-id>/*</from-view-id>
|
||||||
<navigation-case>
|
<navigation-case>
|
||||||
|
<description>Go Home</description>
|
||||||
<from-outcome>home</from-outcome>
|
<from-outcome>home</from-outcome>
|
||||||
<to-view-id>main.jsf</to-view-id>
|
<to-view-id>/main.xhtml</to-view-id>
|
||||||
<redirect/>
|
<redirect/>
|
||||||
</navigation-case>
|
</navigation-case>
|
||||||
</navigation-rule>
|
</navigation-rule>
|
||||||
|
|
|
@ -22,6 +22,15 @@ textarea {
|
||||||
font-size: 1em
|
font-size: 1em
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
.noprint {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.printonly {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#footer {
|
#footer {
|
||||||
bottom: 90px;
|
bottom: 90px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
@ -23,9 +23,11 @@
|
||||||
style="vertical-align: middle; text-align: left; border: none"
|
style="vertical-align: middle; text-align: left; border: none"
|
||||||
>
|
>
|
||||||
<p:commandButton value="Back"
|
<p:commandButton value="Back"
|
||||||
|
immediate="true" ajax="false"
|
||||||
icon="ui-icon-arrowthick-1-w"
|
icon="ui-icon-arrowthick-1-w"
|
||||||
style="margin-left: 2em" immediate="true"
|
style="margin-left: 2em"
|
||||||
action="/recipeDetails.jsf"
|
styleClass="noprint"
|
||||||
|
action="recipeDetails.jsf?faces-redirect=true"
|
||||||
/>
|
/>
|
||||||
</p:column>
|
</p:column>
|
||||||
</p:panelGrid>
|
</p:panelGrid>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user