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 adminConsoleTopbarTitle;
private String topbarTitle;
private String logoImageUrl;
private String adminConsoleCopyrightFooter;
private String adminConsoleLandingPageText;
public ConfigurationPropertiesBean() {
}
/**
* @return the baseUrl
* @return the issuer baseUrl
*/
public String getIssuer() {
return issuer;
@ -55,36 +51,32 @@ public class ConfigurationPropertiesBean {
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() {
return logoImageUrl;
}
/**
* @param logoImageUrl the logoImageUrl to set
*/
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

@ -35,31 +35,18 @@ public class ManagerController {
@Autowired
private StatsService statsService;
@Autowired
private ConfigurationPropertiesBean configBean;
@RequestMapping({"", "home", "index"})
public String showHomePage(ModelMap m) {
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";
}
@ -69,37 +56,19 @@ 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(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";
return "manage";
}
public StatsService getStatsService() {
@ -110,12 +79,4 @@ public class ManagerController {
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;
/**
* 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
*
*/

View File

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

View File

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

View File

@ -1,5 +1 @@
<div id="footer">
<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>
Powered by <a href="https://github.com/mitreid-connect/">MITREid Connect</a> &copy; 2013 The MITRE Corporation.

View File

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

View File

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

View File

@ -1,5 +1,8 @@
<h2>Current Statistics</h2>
<p>There have been <span class="label label-info">${statsSummary["userCount"]}</span> users of this
system who have logged in to <span class="label label-info">${statsSummary["clientCount"]}</span>
total sites, for a total of <span class="label label-info">${statsSummary["approvalCount"]}</span> site approvals.</p>
<p>There have been
<span class="label label-info">${statsSummary["userCount"]}</span> user${statsSummary["userCount"] == 1 ? "" : "s"}
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="title" required="true" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="o" tagdir="/WEB-INF/tags" %>
@ -26,14 +25,6 @@
</c:choose>
</c:otherwise>
</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-inner">
<div class="container">
@ -42,7 +33,7 @@ $(document).ready(function() {
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="">${title}</a>
<a class="brand" href="">${config.topbarTitle}</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 title="${topbarTitle}" pageName="About"/>
<o:topbar pageName="About"/>
<div class="container-fluid main">
<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 title="${topbarTitle}" pageName="Contact"/>
<o:topbar pageName="Contact"/>
<div class="container-fluid main">
<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 title="${topbarTitle}"/>
<o:topbar />
<div class="container-fluid main">
<div class="row-fluid">
<o:sidebar/>

View File

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

View File

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

View File

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

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 title="${topbarTitle}" pageName="Statistics"/>
<o:topbar pageName="Statistics"/>
<div class="container-fluid main">
<div class="row-fluid">
<o:sidebar/>