Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Local override #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 53 additions & 37 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@
<version>1.0.0-BUILD-SNAPSHOT</version>
<properties>
<java-version>1.6</java-version>
<org.springframework-version>3.2.3.RELEASE</org.springframework-version>
<org.springframework-version>4.3.23.RELEASE</org.springframework-version>
<org.aspectj-version>1.6.9</org.aspectj-version>
<org.slf4j-version>1.5.10</org.slf4j-version>
<spring.security.version>3.1.4.RELEASE</spring.security.version>
<mitreid-connect-version>1.1.12</mitreid-connect-version>
<mitreid-connect-version>1.1.19</mitreid-connect-version>
<webapp.home>${basedir}</webapp.home>
<debug.suspend>n</debug.suspend>
<webapp.jvmargs></webapp.jvmargs>
</properties>
<dependencies>
<dependency>
Expand All @@ -31,22 +34,22 @@
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>

<!-- AspectJ -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${org.aspectj-version}</version>
</dependency>
</dependency>

<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
Expand Down Expand Up @@ -96,7 +99,7 @@
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>

<!-- Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
Expand All @@ -115,25 +118,25 @@
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>

<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>${spring.security.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>${spring.security.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down Expand Up @@ -185,25 +188,38 @@
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.3.6.v20151106</version>
<configuration>
<jettyXml>${project.basedir}/etc/jetty/jetty.xml,${project.basedir}/etc/jetty/jetty-ssl.xml,${project.basedir}/etc/jetty/jetty-https.xml</jettyXml>
<webApp>
<contextPath>/simple-web-app</contextPath>
</webApp>
<systemProperties>
<systemProperty>
<name>org.eclipse.jetty.annotations.maxWait</name>
<value>240</value>
</systemProperty>
</systemProperties>
<!-- Works with remote debugging and mvn jetty:run-forked -->
<jvmArgs>-Xdebug -Xrunjdwp:transport=dt_socket,address=5001,server=y,suspend=n</jvmArgs>
</configuration>
</plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.3.6.v20151106</version>
<configuration>
<jettyXml>${project.basedir}/etc/jetty/jetty.xml,${project.basedir}/etc/jetty/jetty-ssl.xml,${project.basedir}/etc/jetty/jetty-https.xml</jettyXml>
<webApp>
<contextPath>/simple-web-app</contextPath>
</webApp>
<systemProperties>
<systemProperty>
<name>org.eclipse.jetty.annotations.maxWait</name>
<value>240</value>
</systemProperty>
</systemProperties>
<!-- Works with remote debugging and mvn jetty:run-forked -->
<jvmArgs>${webapp.jvmArgs} -Xdebug -Xrunjdwp:transport=dt_socket,address=5001,server=y,suspend=${debug.suspend} -Dwebapp.home=${webapp.home}</jvmArgs>
</configuration>
</plugin>
</plugins>
</build>
<name>simple-web-app</name>
<profiles>
<profile>
<id>windows</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<properties>
<webapp.home>/${basedir}</webapp.home>
</properties>
</profile>
</profiles>
</project>
9 changes: 7 additions & 2 deletions src/main/webapp/WEB-INF/servlet.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
host=mmoayyed.unicon.net

# server.url=https://mmoayyed.unicon.net:8443/idp/
# server.authz.url=${server.url}profile/oidc/authorize
# server.token.url=${server.url}profile/oidc/token
# server.userinfo.url=${server.url}profile/oidc/userinfo
# server.jwks.url=${server.url}profile/oidc/jwk
# server.registration.url=${server.url}profile/oidc/register

server.url=https://mmoayyed.unicon.net:8443/cas/oidc/
server.url=https://${host}:8443/cas/oidc/
# server.url=http://localhost:8080/openid-connect-server-webapp/

# Only applies to static/hybrid server config
Expand All @@ -24,4 +26,7 @@ serverConfigurationService=staticServerConfigurationService
# clientConfigurationService=dynamicClientConfigurationService
clientConfigurationService=staticClientConfigurationService
authRequestOptionsService=staticAuthRequestOptionsService
authRequestUrlBuilder=plainAuthRequestUrlBuilder
authRequestUrlBuilder=plainAuthRequestUrlBuilder

webapp.url=https://${host}:9443/simple-web-app/
webapp.login.url=${webapp.url}openid_connect_login
36 changes: 22 additions & 14 deletions src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,24 @@
<mvc:resources mapping="/resources/**" location="/resources/" />

<!--Add placeholder properties-->
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="properties" ref="properties" />
<bean id="placeholderConfigurer" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">
<property name="propertiesArray">
<array>
<bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="location" value="WEB-INF/servlet.properties" />
</bean>
<bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="location" value="file://${webapp.home}/local-values.conf" />
<property name="ignoreResourceNotFound" value="true" />
</bean>
</array>
</property>
</bean>

<bean id="properties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="location" value="WEB-INF/servlet.properties" />
<bean id="properties" class="org.springframework.core.env.PropertySourcesPropertyResolver">
<constructor-arg>
<bean factory-bean="placeholderConfigurer" factory-method="getAppliedPropertySources" />
</constructor-arg>
</bean>

<!-- Resolves views selected for rendering by @Controllers to .jsp resources
Expand All @@ -44,9 +55,6 @@
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
<property name="exposedContextBeanNames">
<list><value>properties</value></list>
</property>
</bean>

<context:component-scan base-package="org.mitre.web" />
Expand Down Expand Up @@ -239,12 +247,12 @@
<property name="tokenEndpointAuthMethod" value="SECRET_BASIC" />
<property name="redirectUris">
<set>
<value>https://mmoayyed.unicon.net:9443/simple-web-app/openid_connect_login</value>
<value>${webapp.login.url}</value>
</set>
</property>
<!-- for signed requests -->
<property name="requestObjectSigningAlg" value="RS256" />
<property name="jwksUri" value="https://mmoayyed.unicon.net:9443/simple-web-app/jwk" />
<property name="jwksUri" value="${webapp.url}jwk" />
</bean>
</property>
<!--
Expand Down Expand Up @@ -285,7 +293,7 @@
<property name="tokenEndpointAuthMethod" value="SECRET_BASIC" />
<property name="redirectUris">
<set>
<value>https://mmoayyed.unicon.net:9443/simple-web-app/openid_connect_login</value>
<value>${webapp.login.url}</value>
</set>
</property>
</bean>
Expand Down Expand Up @@ -317,7 +325,7 @@
<property name="tokenEndpointAuthMethod" value="SECRET_BASIC" />
<property name="redirectUris">
<set>
<value>https://mmoayyed.unicon.net:9443/simple-web-app/openid_connect_login</value>
<value>${webapp.login.url}</value>
</set>
</property>

Expand All @@ -340,7 +348,7 @@
<property name="tokenEndpointAuthMethod" value="SECRET_BASIC" />
<property name="redirectUris">
<set>
<value>https://mmoayyed.unicon.net:9443/simple-web-app/openid_connect_login</value>
<value>${webapp.login.url}</value>
</set>
</property>
</bean>
Expand Down Expand Up @@ -376,7 +384,7 @@
<entry key="prompt" value="none" />
-->
<entry key="acr_values" value="mfa-gauth,mfa-duo" />

</map>
</property>
</bean>
Expand Down
3 changes: 2 additions & 1 deletion src/main/webapp/WEB-INF/views/login.jsp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="o" tagdir="/WEB-INF/tags"%>
<o:header title="Login"/>
Expand Down Expand Up @@ -42,7 +43,7 @@

<script type="text/javascript">
$(document).ready(function () {
$('#identifier').val('${properties["server.url"]}');
$('#identifier').val('<spring:eval expression="@properties.getProperty('server.url')" />');
});
</script>
<o:footer />