First steps towards adding display variables to config bean

pull/306/merge
Amanda Anganes 2013-02-22 17:07:31 -05:00
parent 92f5f31dfc
commit 60b679e942
11 changed files with 104 additions and 10 deletions

View File

@ -33,7 +33,16 @@ public class ConfigurationPropertiesBean {
private String defaultJwtSigner;
private JWSAlgorithm defaultAlgorithm;
private String adminConsoleTopbarTitle;
private String logoImageUrl;
private String adminConsoleCopyrightFooter;
private String adminConsoleLandingPageText;
public ConfigurationPropertiesBean() {
}
@ -80,4 +89,37 @@ public class ConfigurationPropertiesBean {
return null;
}
}
public String getAdminConsoleTopbarTitle() {
return adminConsoleTopbarTitle;
}
public void setAdminConsoleTopbarTitle(String adminConsoleTopbarTitle) {
this.adminConsoleTopbarTitle = adminConsoleTopbarTitle;
}
public String getLogoImageUrl() {
return logoImageUrl;
}
public void setLogoImageUrl(String logoImageUrl) {
this.logoImageUrl = logoImageUrl;
}
public String getAdminConsoleCopyrightFooter() {
return adminConsoleCopyrightFooter;
}
public void setAdminConsoleCopyrightFooter(String adminConsoleCopyrightFooter) {
this.adminConsoleCopyrightFooter = adminConsoleCopyrightFooter;
}
public String getAdminConsoleLandingPageText() {
return adminConsoleLandingPageText;
}
public void setAdminConsoleLandingPageText(String adminConsoleLandingPageText) {
this.adminConsoleLandingPageText = adminConsoleLandingPageText;
}
}

View File

@ -17,6 +17,7 @@ package org.mitre.openid.connect.web;
import java.util.Map;
import org.mitre.openid.connect.config.ConfigurationPropertiesBean;
import org.mitre.openid.connect.service.StatsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@ -33,6 +34,9 @@ public class ManagerController {
@Autowired
private StatsService statsService;
@Autowired
private ConfigurationPropertiesBean configBean;
@RequestMapping({"", "home", "index"})
public String showHomePage(ModelMap m) {
@ -40,12 +44,22 @@ public class ManagerController {
Map<String, Integer> summary = statsService.calculateSummaryStats();
m.put("statsSummary", summary);
m.put("topbarTitle", configBean.getAdminConsoleTopbarTitle());
m.put("landingPageText", configBean.getAdminConsoleLandingPageText());
m.put("copyright", configBean.getAdminConsoleCopyrightFooter());
m.put("logoUrl", configBean.getLogoImageUrl());
return "home";
}
@RequestMapping({"about", "about/"})
public String showAboutPage(ModelMap m) {
m.put("topbarTitle", configBean.getAdminConsoleTopbarTitle());
m.put("landingPageText", configBean.getAdminConsoleLandingPageText());
m.put("copyright", configBean.getAdminConsoleCopyrightFooter());
m.put("logoUrl", configBean.getLogoImageUrl());
return "about";
}
@ -55,20 +69,53 @@ public class ManagerController {
Map<String, Integer> summary = statsService.calculateSummaryStats();
m.put("statsSummary", summary);
m.put("statsSummary", summary);
m.put("topbarTitle", configBean.getAdminConsoleTopbarTitle());
m.put("landingPageText", configBean.getAdminConsoleLandingPageText());
m.put("copyright", configBean.getAdminConsoleCopyrightFooter());
m.put("logoUrl", configBean.getLogoImageUrl());
return "stats";
}
@RequestMapping({"contact", "contact/"})
public String showContactPage(ModelMap m) {
m.put("topbarTitle", configBean.getAdminConsoleTopbarTitle());
m.put("landingPageText", configBean.getAdminConsoleLandingPageText());
m.put("copyright", configBean.getAdminConsoleCopyrightFooter());
m.put("logoUrl", configBean.getLogoImageUrl());
return "contact";
}
@PreAuthorize("hasRole('ROLE_USER')") // TODO: this probably shouldn't be here
@RequestMapping("manage/**")
public String showClientManager() {
public String showClientManager(ModelMap m) {
// TODO: move view
m.put("topbarTitle", configBean.getAdminConsoleTopbarTitle());
m.put("landingPageText", configBean.getAdminConsoleLandingPageText());
m.put("copyright", configBean.getAdminConsoleCopyrightFooter());
m.put("logoUrl", configBean.getLogoImageUrl());
return "admin/manage";
}
public StatsService getStatsService() {
return statsService;
}
public void setStatsService(StatsService statsService) {
this.statsService = statsService;
}
public ConfigurationPropertiesBean getConfigBean() {
return configBean;
}
public void setConfigBean(ConfigurationPropertiesBean configBean) {
this.configBean = configBean;
}
}

View File

@ -16,6 +16,10 @@
<property name="issuer" value="http://localhost/" />
<property name="defaultJwtSigner" value="rsa1"/>
<property name="defaultSigningAlgorithmName" value="RS256" />
<property name="adminConsoleCopyrightFooter" value="The MTIRE Corporation" />
<property name="adminConsoleLandingPageText" value="Welcome to the MITRE Corporation OpenID Connect Server!" />
<property name="logoImageUrl" value="https://id.mitre.org/connect/resources/images/openid_connect_small.png" />
<property name="adminConsoleTopbarTitle" value="MITREid Connect" />
</bean>
</beans>

View File

@ -1,4 +1,5 @@
<%@attribute name="pageName" required="false" %>
<%@attribute name="title" required="true" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<c:choose>
@ -33,7 +34,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="">OpenID Connect Server</a>
<a class="brand" href="">${title}</a>
<div class="nav-collapse collapse">
<ul class="nav">
<c:choose>

View File

@ -5,7 +5,7 @@
<!-- TODO: highlight proper section of topbar; what is the right way to do this? -->
<o:header title="welcome"/>
<o:topbar pageName="About"/>
<o:topbar title="${topbarTitle}" pageName="About"/>
<div class="container-fluid">
<div class="row-fluid">
<o:sidebar/>

View File

@ -2,7 +2,7 @@
<%@ taglib prefix="o" tagdir="/WEB-INF/tags" %>
<o:header title="welcome"/>
<o:topbar/>
<o:topbar title="${topbarTitle}"/>
<div class="container-fluid">
<div class="row-fluid">
<o:sidebar/>

View File

@ -5,7 +5,7 @@
<!-- TODO: highlight proper section of topbar; what is the right way to do this? -->
<o:header title="welcome"/>
<o:topbar pageName="Contact"/>
<o:topbar title="${topbarTitle}" pageName="Contact"/>
<div class="container-fluid">
<div class="row-fluid">
<o:sidebar/>

View File

@ -3,7 +3,7 @@
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<o:header title="welcome"/>
<o:topbar/>
<o:topbar title="${topbarTitle}"/>
<div class="container-fluid">
<div class="row-fluid">
<o:sidebar/>

View File

@ -11,7 +11,7 @@ $(document).ready(function() {
//-->
</script>
<o:topbar/>
<o:topbar title="${topbarTitle}"/>
<div class="container">
<h1>Login with Username and Password</h1>

View File

@ -6,7 +6,7 @@
<%@ taglib prefix="o" tagdir="/WEB-INF/tags" %>
<o:header title="Approve Access"/>
<o:topbar/>
<o:topbar title="${topbarTitle}"/>
<div class="container">
<% if (session.getAttribute(AbstractAuthenticationProcessingFilter.SPRING_SECURITY_LAST_EXCEPTION_KEY) != null && !(session.getAttribute(AbstractAuthenticationProcessingFilter.SPRING_SECURITY_LAST_EXCEPTION_KEY) instanceof UnapprovedClientAuthenticationException)) { %>
<div class="alert-message error">

View File

@ -5,7 +5,7 @@
<!-- TODO: highlight proper section of topbar; what is the right way to do this? -->
<o:header title="welcome"/>
<o:topbar pageName="Statistics"/>
<o:topbar title="${topbarTitle}" pageName="Statistics"/>
<div class="container-fluid">
<div class="row-fluid">
<o:sidebar/>