Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into bugfix/shibui-2257
Browse files Browse the repository at this point in the history
# Conflicts:
#	backend/build.gradle
#	gradle.properties
  • Loading branch information
chasegawa committed Jun 9, 2022
2 parents 04049e5 + 1573adc commit bb0ef1b
Show file tree
Hide file tree
Showing 51 changed files with 536 additions and 396 deletions.
94 changes: 53 additions & 41 deletions backend/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
plugins {
id 'groovy'
id 'war'
id 'org.springframework.boot' version '2.4.2'
id 'com.gorylenko.gradle-git-properties' version '1.4.21'
id 'io.freefair.lombok' version '5.3.0'
id 'com.palantir.docker' version '0.28.0'
id 'com.palantir.docker-run' version '0.28.0'
id "groovy"
id "war"
id "org.springframework.boot"
id "io.freefair.lombok"
id "com.gorylenko.gradle-git-properties" version "1.4.21"
id "com.palantir.docker" version "0.28.0"
id "com.palantir.docker-run" version "0.28.0"
}

apply plugin: 'io.spring.dependency-management'
Expand All @@ -14,17 +14,26 @@ apply plugin: 'jacoco'
sourceCompatibility = 11
targetCompatibility = 11

test {
useJUnitPlatform() // Needed by spock to find specification tests
}

repositories {
mavenCentral()
jcenter()
maven {
url 'https://build.shibboleth.net/nexus/content/groups/public'
artifactUrls = ['https://build.shibboleth.net/nexus/content/repositories/thirdparty-snapshots']
}
maven { // for the springboot plugin
url "https://plugins.gradle.org/m2/"
}
mavenLocal()
mavenCentral()
}

configurations.all {
resolutionStrategy {
force 'org.cryptacular:cryptacular:1.1.3'
force "org.cryptacular:cryptacular:${project.'cryptacularVersion'}"

eachDependency { details ->
if (details.requested.group == 'org.seleniumhq.selenium' && details.requested.name != 'htmlunit-driver') {
Expand Down Expand Up @@ -104,7 +113,7 @@ bootWar {
}

springBoot {
mainClassName = 'edu.internet2.tier.shibboleth.admin.ui.ShibbolethUiApplication'
mainClass = 'edu.internet2.tier.shibboleth.admin.ui.ShibbolethUiApplication'
buildInfo()
}

Expand All @@ -113,43 +122,41 @@ generateLombokConfig.enabled = false
dependencies {
// opensaml deps
['opensaml-saml-api', 'opensaml-saml-impl', 'opensaml-xmlsec-api', 'opensaml-xmlsec-impl'].each {
compile "org.opensaml:${it}:${project.'opensaml.version'}"
compile "org.opensaml:${it}:${project.'opensamlVersion'}"
}

// Left here to save time later - when pac4j is/was updated, I needed all of these to get the runtime right with the SAML2 client
// runtimeOnly "org.bouncycastle:bcprov-jdk15on:1.69"
// runtimeOnly "org.bouncycastle:bcprov-ext-jdk15on:1.69"
// runtimeOnly "org.bouncycastle:bcutil-jdk15on:1.69"
// runtimeOnly "org.bouncycastle:bcpkix-jdk15on:1.69"

runtimeOnly "org.bouncycastle:bcprov-jdk15on:1.70"
runtimeOnly "org.bouncycastle:bcprov-ext-jdk15on:1.70"
runtimeOnly "org.bouncycastle:bcutil-jdk15on:1.70"
runtimeOnly "org.bouncycastle:bcpkix-jdk15on:1.70"

// shibboleth idp deps
['idp-profile-spring', 'idp-profile-api'].each {
compile "net.shibboleth.idp:${it}:${project.'shibboleth.version'}"
compile "net.shibboleth.idp:${it}:${project.'shibbolethVersion'}"
}

// hibernate deps
['hibernate-core'].each {
compile "org.hibernate:${it}:${project.'hibernate.version'}"
compile "org.hibernate:${it}:${project.'hibernateVersion'}"
}

// spring boot auto-config starters
['starter-web', 'starter-data-jpa', 'starter-security', 'starter-actuator', 'devtools', 'starter-webflux', 'starter-thymeleaf', 'starter-mail', 'starter-validation'].each {
compile "org.springframework.boot:spring-boot-${it}"
}
// To override older version with security issue - https://www.lunasec.io/docs/blog/log4j-zero-day/
implementation "org.apache.logging.log4j:log4j-to-slf4j:${project.'log4j.version'}"
implementation "org.apache.logging.log4j:log4j-api:${project.'log4j.version'}"
implementation "org.apache.logging.log4j:log4j-to-slf4j:${project.'log4JVersion'}"
implementation "org.apache.logging.log4j:log4j-api:${project.'log4JVersion'}"

// TODO: figure out what this should really be
runtimeOnly 'org.springframework.boot:spring-boot-starter-tomcat'
runtimeOnly "org.springframework.boot:spring-boot-starter-tomcat:${project.'springbootVersion'}"

//Spring Configuration Annotation Processor - makes IntelliJ happy about @ConfigurationProperties
compileOnly "org.springframework.boot:spring-boot-configuration-processor"
compileOnly "org.springframework.boot:spring-boot-configuration-processor:${project.'springbootVersion'}"

// lucene deps
['core', 'analyzers-common', 'queryparser'].each {
compile "org.apache.lucene:lucene-${it}:${project.'lucene.version'}"
compile "org.apache.lucene:lucene-${it}:${project.'luceneVersion'}"
}

compile "org.liquibase:liquibase-core"
Expand All @@ -158,30 +165,32 @@ dependencies {
//For easy data mocking capabilities
compile 'net.andreinc:mockneat:0.4.7'

compile 'org.codehaus.groovy:groovy-all:3.0.7'

//So it works on Java 9 without explicitly requiring to load that module (needed by Hibernate)
runtimeOnly 'javax.xml.bind:jaxb-api:2.3.0'
// runtime libraries for later java versions
runtimeOnly 'org.glassfish.jaxb:jaxb-runtime:2.3.0'

compile "com.h2database:h2"
runtimeOnly "org.postgresql:postgresql:42.2.20"
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client:2.2.0'
runtimeOnly 'mysql:mysql-connector-java:5.1.48'
runtimeOnly 'org.postgresql:postgresql:42.3.4'
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client:3.0.4'
runtimeOnly 'mysql:mysql-connector-java:8.0.29'

//Swagger
compile 'io.springfox:springfox-swagger2:2.9.2'
compile 'io.springfox:springfox-swagger-ui:2.9.2'

testCompile "org.springframework.boot:spring-boot-starter-test"
testCompile "org.springframework.security:spring-security-test"
testCompile "org.spockframework:spock-core:1.3-groovy-2.5"
testCompile "org.spockframework:spock-spring:1.3-groovy-2.5"
compile 'org.codehaus.groovy:groovy-all:3.0.10'
testImplementation platform("org.spockframework:spock-bom:2.1-groovy-3.0")
testImplementation "org.spockframework:spock-core"
testImplementation "org.spockframework:spock-spring"

testCompile "org.springframework.boot:spring-boot-starter-test:${project.'springbootVersion'}"
testCompile "org.springframework.security:spring-security-test:${project.'springSecurityVersion'}"
testCompile 'org.skyscreamer:jsonassert:1.5.0'
testCompile "org.xmlunit:xmlunit-core:2.5.1"
testRuntime 'cglib:cglib-nodep:3.2.5'

compile "net.shibboleth.ext:spring-extensions:5.4.0"
compile "net.shibboleth.ext:spring-extensions:6.2.0"

//JSON schema generator
testCompile 'com.kjetland:mbknor-jackson-jsonschema_2.12:1.0.29'
Expand All @@ -195,18 +204,18 @@ dependencies {
integrationTestCompile configurations.compile
integrationTestCompile 'com.saucelabs:sebuilder-interpreter:1.0.6'
integrationTestCompile 'jp.vmi:selenese-runner-java:3.20.0'
integrationTestCompile "org.springframework.boot:spring-boot-starter-test"
integrationTestCompile "org.springframework.security:spring-security-test"
integrationTestCompile "org.spockframework:spock-core:1.3-groovy-2.5"
integrationTestCompile "org.spockframework:spock-spring:1.3-groovy-2.5"
integrationTestCompile "org.springframework.boot:spring-boot-starter-test:${project.'springbootVersion'}"
integrationTestCompile "org.springframework.security:spring-security-test:${project.'springSecurityVersion'}"

// CSV file support
compile 'com.opencsv:opencsv:4.4'
compile 'com.opencsv:opencsv:4.4', {
exclude group: 'commons-collections'
}

testCompile 'org.skyscreamer:jsonassert:1.5.0'
compile "org.apache.commons:commons-collections4:${project.'commonsCollections4Version'}"

// Envers for persistent entities versioning
compile 'org.hibernate:hibernate-envers'
compile "org.hibernate:hibernate-envers:${project.'hibernateVersion'}"

//Pacj4 sub-project
runtimeOnly project(':pac4j-module')
Expand All @@ -218,7 +227,9 @@ dependencies {
enversTestCompile sourceSets.test.output
enversTestCompile configurations.compile
enversTestCompile configurations.testCompile
enversTestCompile configurations.testImplementation

enversTestRuntime configurations.testImplementation
enversTestRuntime configurations.runtime
enversTestRuntime configurations.testRuntime
}
Expand Down Expand Up @@ -246,6 +257,7 @@ task enversTest(type: Test) {
classpath = sourceSets.enversTest.runtimeClasspath
systemProperties = System.properties
systemProperties['user.dir'] = workingDir
useJUnitPlatform()
}

check {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import groovy.util.logging.Slf4j
import groovy.xml.DOMBuilder
import groovy.xml.MarkupBuilder
import net.shibboleth.utilities.java.support.scripting.EvaluableScript
import org.apache.commons.collections.CollectionUtils
import org.apache.commons.collections4.CollectionUtils
import org.opensaml.saml.common.profile.logic.EntityIdPredicate
import org.opensaml.saml.metadata.resolver.MetadataResolver
import org.opensaml.saml.metadata.resolver.filter.MetadataFilter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package edu.internet2.tier.shibboleth.admin.ui.configuration;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.ResourceProperties;
import org.springframework.boot.autoconfigure.web.WebProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
Expand All @@ -17,7 +17,7 @@
*/

@Configuration
@EnableConfigurationProperties({ResourceProperties.class})
@EnableConfigurationProperties({WebProperties.class})
public class StaticResourcesConfiguration implements WebMvcConfigurer {
static final String[] STATIC_RESOURCES = new String[]{
"/**/*.css",
Expand All @@ -36,16 +36,17 @@ public class StaticResourcesConfiguration implements WebMvcConfigurer {
};

@Autowired
private ResourceProperties resourceProperties = new ResourceProperties();
private WebProperties resourceProperties = new WebProperties();

@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {

registry.addResourceHandler(STATIC_RESOURCES)
.addResourceLocations(resourceProperties.getStaticLocations())
.addResourceLocations(resourceProperties.getResources().getStaticLocations())
.setCachePeriod(10);
registry.addResourceHandler("/**")
.addResourceLocations(
Arrays.stream(resourceProperties.getStaticLocations())
Arrays.stream(resourceProperties.getResources().getStaticLocations())
.map(l -> l + "index.html")
.toArray(String[]::new)
)
Expand All @@ -59,4 +60,4 @@ protected Resource getResource(String resourcePath, Resource location) throws IO
}
);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
package edu.internet2.tier.shibboleth.admin.ui.domain;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.temporal.ChronoUnit;

import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;
import org.hibernate.envers.Audited;
Expand All @@ -24,11 +12,19 @@
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;

import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.temporal.ChronoUnit;

@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
Expand All @@ -42,13 +38,13 @@ public abstract class AbstractAuditable implements Auditable {

@CreationTimestamp
@CreatedDate
@Column(nullable = false, updatable = false, columnDefinition = "DATETIME(6)")
@Column(nullable = false, updatable = false)
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSSSS")
private LocalDateTime createdDate;

@UpdateTimestamp
@LastModifiedDate
@Column(nullable = false, columnDefinition = "DATETIME(6)")
@Column(nullable = false)
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSSSS")
private LocalDateTime modifiedDate;

Expand Down Expand Up @@ -81,7 +77,7 @@ public LocalDateTime getCreatedDate() {

@Override
public void setCreatedDate(LocalDateTime createdDate) {
this.createdDate = createdDate;
this.createdDate = createdDate == null ? null : createdDate.truncatedTo(ChronoUnit.NANOS);
}

@Override
Expand All @@ -91,7 +87,7 @@ public LocalDateTime getModifiedDate() {

@Override
public void setModifiedDate(LocalDateTime modifiedDate) {
this.modifiedDate = modifiedDate;
this.modifiedDate = modifiedDate == null ? null : modifiedDate.truncatedTo(ChronoUnit.NANOS);
}

public String getCreatedBy() {
Expand Down Expand Up @@ -134,4 +130,4 @@ private static ZonedDateTime toZonedDateTime(LocalDateTime localDateTime) {
.toZonedDateTime()
.truncatedTo(ChronoUnit.MILLIS);
}
}
}
Loading

0 comments on commit bb0ef1b

Please sign in to comment.