url -> uri in approval page

pull/306/merge
Justin Richer 2013-03-07 10:35:13 -05:00
parent 7c36f9fb38
commit 6320fce9fd
18 changed files with 89 additions and 100 deletions

View File

@ -29,20 +29,16 @@ public class ConfigurationPropertiesBean {
private String issuer; private String issuer;
private String adminConsoleTopbarTitle; private String topbarTitle;
private String logoImageUrl; private String logoImageUrl;
private String adminConsoleCopyrightFooter;
private String adminConsoleLandingPageText;
public ConfigurationPropertiesBean() { public ConfigurationPropertiesBean() {
} }
/** /**
* @return the baseUrl * @return the issuer baseUrl
*/ */
public String getIssuer() { public String getIssuer() {
return issuer; return issuer;
@ -55,36 +51,32 @@ public class ConfigurationPropertiesBean {
issuer = iss; issuer = iss;
} }
public String getAdminConsoleTopbarTitle() { /**
return adminConsoleTopbarTitle; * @return the topbarTitle
*/
public String getTopbarTitle() {
return topbarTitle;
} }
public void setAdminConsoleTopbarTitle(String adminConsoleTopbarTitle) { /**
this.adminConsoleTopbarTitle = adminConsoleTopbarTitle; * @param topbarTitle the topbarTitle to set
*/
public void setTopbarTitle(String topbarTitle) {
this.topbarTitle = topbarTitle;
} }
/**
* @return the logoImageUrl
*/
public String getLogoImageUrl() { public String getLogoImageUrl() {
return logoImageUrl; return logoImageUrl;
} }
/**
* @param logoImageUrl the logoImageUrl to set
*/
public void setLogoImageUrl(String logoImageUrl) { public void setLogoImageUrl(String logoImageUrl) {
this.logoImageUrl = 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

@ -35,31 +35,18 @@ public class ManagerController {
@Autowired @Autowired
private StatsService statsService; private StatsService statsService;
@Autowired
private ConfigurationPropertiesBean configBean;
@RequestMapping({"", "home", "index"}) @RequestMapping({"", "home", "index"})
public String showHomePage(ModelMap m) { public String showHomePage(ModelMap m) {
Map<String, Integer> summary = statsService.calculateSummaryStats(); 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 "home"; return "home";
} }
@RequestMapping({"about", "about/"}) @RequestMapping({"about", "about/"})
public String showAboutPage(ModelMap m) { 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"; return "about";
} }
@ -69,37 +56,19 @@ public class ManagerController {
Map<String, Integer> summary = statsService.calculateSummaryStats(); Map<String, Integer> summary = statsService.calculateSummaryStats();
m.put("statsSummary", summary); 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"; return "stats";
} }
@RequestMapping({"contact", "contact/"}) @RequestMapping({"contact", "contact/"})
public String showContactPage(ModelMap m) { 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"; return "contact";
} }
@PreAuthorize("hasRole('ROLE_USER')") // TODO: this probably shouldn't be here @PreAuthorize("hasRole('ROLE_USER')") // TODO: this probably shouldn't be here
@RequestMapping("manage/**") @RequestMapping("manage/**")
public String showClientManager(ModelMap m) { public String showClientManager(ModelMap m) {
// TODO: move view return "manage";
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() { public StatsService getStatsService() {
@ -110,12 +79,4 @@ public class ManagerController {
this.statsService = statsService; this.statsService = statsService;
} }
public ConfigurationPropertiesBean getConfigBean() {
return configBean;
}
public void setConfigBean(ConfigurationPropertiesBean configBean) {
this.configBean = configBean;
}
} }

View File

@ -0,0 +1,36 @@
/**
*
*/
package org.mitre.openid.connect.web;
import java.security.Principal;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.mitre.openid.connect.config.ConfigurationPropertiesBean;
import org.mitre.openid.connect.model.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
/**
*
* Injects the server configuration bean into the Model context, if it exists. Allows JSPs and the like to call "config.logoUrl" among others.
*
* @author jricher
*
*/
public class ServerConfigInterceptor extends HandlerInterceptorAdapter {
@Autowired
private ConfigurationPropertiesBean config;
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
if (modelAndView != null) { // skip checking at all if we have no model and view to hand the config to
modelAndView.addObject("config", config);
}
}
}

View File

@ -16,6 +16,8 @@ import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
/** /**
* Injects the UserInfo object for the current user into the current model's context, if both exist. Allows JSPs and the like to call "userInfo.name" and other fields.
*
* @author jricher * @author jricher
* *
*/ */

View File

@ -24,7 +24,9 @@
<mvc:interceptors> <mvc:interceptors>
<!-- Inject the UserInfo into the current context --> <!-- Inject the UserInfo into the current context -->
<bean id="userInfoInterceptor" class="org.mitre.openid.connect.web.UserInfoInterceptor" /> <bean id="userInfoInterceptor" class="org.mitre.openid.connect.web.UserInfoInterceptor" />
<bean id="serverConfigInterceptor" class="org.mitre.openid.connect.web.ServerConfigInterceptor" />
</mvc:interceptors> </mvc:interceptors>
<mvc:default-servlet-handler /> <mvc:default-servlet-handler />
<!-- Bean to hold configuration properties --> <!-- Bean to hold configuration properties -->

View File

@ -14,9 +14,8 @@
<bean id="configBean" class="org.mitre.openid.connect.config.ConfigurationPropertiesBean"> <bean id="configBean" class="org.mitre.openid.connect.config.ConfigurationPropertiesBean">
<property name="issuer" value="http://localhost/" /> <property name="issuer" value="http://localhost/" />
<property name="adminConsoleCopyrightFooter" value="The MTIRE Corporation" /> <property name="logoImageUrl" value="resources/images/openid_connect_small.png" />
<property name="logoImageUrl" value="https://id.mitre.org/connect/resources/images/openid_connect_small.png" /> <property name="topbarTitle" value="OpenID Connect Server" />
<property name="adminConsoleTopbarTitle" value="MITREid Connect" />
</bean> </bean>
</beans> </beans>

View File

@ -1,5 +1 @@
<div id="footer"> Powered by <a href="https://github.com/mitreid-connect/">MITREid Connect</a> &copy; 2013 The MITRE Corporation.
<div class="container">
<p class="muted credit">Powered by <a href="https://github.com/mitreid-connect/">MITREid Connect</a> &copy; 2013 The MITRE Corporation</p>
</div>
</div>

View File

@ -4,7 +4,11 @@
<%@ taglib prefix="o" tagdir="/WEB-INF/tags" %> <%@ taglib prefix="o" tagdir="/WEB-INF/tags" %>
<div id="push"></div> <div id="push"></div>
</div> <!-- end #wrap --> </div> <!-- end #wrap -->
<o:copyright /> <div id="footer">
<div class="container">
<p class="muted credit"><o:copyright /></p>
</div>
</div>
<!-- Le javascript <!-- Le javascript
================================================== --> ================================================== -->
<!-- Placed at the end of the document so the pages load faster --> <!-- Placed at the end of the document so the pages load faster -->

View File

@ -61,7 +61,10 @@
.credit { .credit {
margin: 20px 0; margin: 20px 0;
} }
a.brand {
background: url('${config.logoImageUrl}') no-repeat scroll 7px 7px transparent;
}
</style> </style>
<link href="resources/bootstrap2/css/bootstrap-responsive.css" rel="stylesheet"> <link href="resources/bootstrap2/css/bootstrap-responsive.css" rel="stylesheet">
<style type="text/css"> <style type="text/css">

View File

@ -1,5 +1,8 @@
<h2>Current Statistics</h2> <h2>Current Statistics</h2>
<p>There have been <span class="label label-info">${statsSummary["userCount"]}</span> users of this <p>There have been
system who have logged in to <span class="label label-info">${statsSummary["clientCount"]}</span> <span class="label label-info">${statsSummary["userCount"]}</span> user${statsSummary["userCount"] == 1 ? "" : "s"}
total sites, for a total of <span class="label label-info">${statsSummary["approvalCount"]}</span> site approvals.</p> of this system who have logged in to
<span class="label label-info">${statsSummary["clientCount"]}</span> total site${statsSummary["clientCount"] == 1 ? "" : "s"},
for a total of
<span class="label label-info">${statsSummary["approvalCount"]}</span> site approval${statsSummary["approvalCount"] == 1 ? "" : "s"}.</p>

View File

@ -1,5 +1,4 @@
<%@attribute name="pageName" required="false" %> <%@attribute name="pageName" required="false" %>
<%@attribute name="title" required="true" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %> <%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="o" tagdir="/WEB-INF/tags" %> <%@ taglib prefix="o" tagdir="/WEB-INF/tags" %>
@ -26,14 +25,6 @@
</c:choose> </c:choose>
</c:otherwise> </c:otherwise>
</c:choose> </c:choose>
<script type="text/javascript">
$(document).ready(function() {
$('a.brand').css("background", "url('" + "${logoUrl}" + "') no-repeat scroll 7px 7px transparent");
});
</script>
<div class="navbar navbar-fixed-top"> <div class="navbar navbar-fixed-top">
<div class="navbar-inner"> <div class="navbar-inner">
<div class="container"> <div class="container">
@ -42,7 +33,7 @@ $(document).ready(function() {
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
<a class="brand" href="">${title}</a> <a class="brand" href="">${config.topbarTitle}</a>
<div class="nav-collapse collapse"> <div class="nav-collapse collapse">
<ul class="nav"> <ul class="nav">
<c:choose> <c:choose>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="o" tagdir="/WEB-INF/tags" %> <%@ taglib prefix="o" tagdir="/WEB-INF/tags" %>
<o:header title="Approve Access"/> <o:header title="Approve Access"/>
<o:topbar title="${topbarTitle}"/> <o:topbar />
<div class="container main"> <div class="container main">
<% if (session.getAttribute(AbstractAuthenticationProcessingFilter.SPRING_SECURITY_LAST_EXCEPTION_KEY) != null && !(session.getAttribute(AbstractAuthenticationProcessingFilter.SPRING_SECURITY_LAST_EXCEPTION_KEY) instanceof UnapprovedClientAuthenticationException)) { %> <% 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"> <div class="alert-message error">
@ -35,10 +35,10 @@
</div> </div>
</c:if> </c:if>
<c:if test="${ not empty client.logoUrl }"> <c:if test="${ not empty client.logoUri }">
<ul class="thumbnails"> <ul class="thumbnails">
<li class="span4"> <li class="span4">
<div class="thumbnail"><img src="${client.logoUrl }"/></div> <div class="thumbnail"><img src="${client.logoUri }"/></div>
</li> </li>
</ul> </ul>
</c:if> </c:if>

View File

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