Skip to content

Commit

Permalink
clean up build issues with metrics dependency and audit endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoayyed committed Feb 12, 2020
1 parent 6e8d041 commit 6d57f72
Show file tree
Hide file tree
Showing 19 changed files with 43 additions and 27 deletions.
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ xercesVersion=2.12.0
idpVersion=3.4.6
idpLibertyIdwsConsumerVersion=1.0.0
xmlapisVersion=1.4.01
dropwizardVersion=4.1.2
bouncyCastleVersion=1.64
shibbolethUtilJavaSupportVersion=7.5.1
jdomVersion=1.1
Expand Down
19 changes: 7 additions & 12 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,13 @@ ext.libraries = [
force = true
}
],
dropwizard : [
dependencies.create("io.dropwizard.metrics:metrics-core:$dropwizardVersion") {
exclude(group: "commons-cli", module: "commons-cli")
exclude(group: "org.slf4j", module: "slf4j-api")
force = true
}
],
sentry : [
dependencies.create("com.getsentry.raven:raven:$sentryRavenVersion") {
exclude(group: "com.fasterxml.jackson.core", module: "jackson-databind")
Expand Down Expand Up @@ -1889,7 +1896,6 @@ ext.libraries = [
exclude(group: "org.apache.httpcomponents", module: "httpclient")
exclude(group: "org.cryptacular", module: "cryptacular")
exclude(group: "commons-collections", module: "commons-collections")
exclude(group: "io.dropwizard.metrics", module: "metrics-core")
exclude(group: "net.shibboleth.utilities", module: "java-support")
exclude(group: "org.opensaml", module: "opensaml-core")
force = true
Expand All @@ -1905,7 +1911,6 @@ ext.libraries = [
exclude(group: "com.google.guava", module: "guava")
exclude(group: "org.cryptacular", module: "cryptacular")
exclude(group: "commons-collections", module: "commons-collections")
exclude(group: "io.dropwizard.metrics", module: "metrics-core")
exclude(group: "net.shibboleth.utilities", module: "java-support")
exclude(group: "commons-codec", module: "commons-codec")
exclude(group: "org.apache.velocity", module: "velocity")
Expand All @@ -1928,7 +1933,6 @@ ext.libraries = [
exclude(group: "com.google.guava", module: "guava")
exclude(group: "org.cryptacular", module: "cryptacular")
exclude(group: "commons-collections", module: "commons-collections")
exclude(group: "io.dropwizard.metrics", module: "metrics-core")
exclude(group: "net.shibboleth.utilities", module: "java-support")
exclude(group: "org.apache.velocity", module: "velocity")
exclude(group: "org.opensaml", module: "opensaml-core")
Expand All @@ -1949,7 +1953,6 @@ ext.libraries = [
exclude(group: "com.google.guava", module: "guava")
exclude(group: "org.cryptacular", module: "cryptacular")
exclude(group: "commons-collections", module: "commons-collections")
exclude(group: "io.dropwizard.metrics", module: "metrics-core")
exclude(group: "net.shibboleth.utilities", module: "java-support")
exclude(group: "org.apache.velocity", module: "velocity")
exclude(group: "org.opensaml", module: "opensaml-core")
Expand All @@ -1969,7 +1972,6 @@ ext.libraries = [
exclude(group: "com.google.guava", module: "guava")
exclude(group: "org.cryptacular", module: "cryptacular")
exclude(group: "commons-collections", module: "commons-collections")
exclude(group: "io.dropwizard.metrics", module: "metrics-core")
exclude(group: "net.shibboleth.utilities", module: "java-support")
exclude(group: "org.opensaml", module: "opensaml-core")
force = true
Expand All @@ -1983,7 +1985,6 @@ ext.libraries = [
exclude(group: "org.apache.httpcomponents", module: "httpclient")
exclude(group: "com.google.guava", module: "guava")
exclude(group: "org.cryptacular", module: "cryptacular")
exclude(group: "io.dropwizard.metrics", module: "metrics-core")
exclude(group: "commons-collections", module: "commons-collections")
exclude(group: "commons-lang", module: "commons-lang")
exclude(group: "net.shibboleth.utilities", module: "java-support")
Expand All @@ -2000,7 +2001,6 @@ ext.libraries = [
exclude(group: "org.apache.httpcomponents", module: "httpclient")
exclude(group: "com.google.guava", module: "guava")
exclude(group: "org.cryptacular", module: "cryptacular")
exclude(group: "io.dropwizard.metrics", module: "metrics-core")
exclude(group: "net.shibboleth.utilities", module: "java-support")
exclude(group: "commons-codec", module: "commons-codec")
exclude(group: "commons-collections", module: "commons-collections")
Expand All @@ -2021,7 +2021,6 @@ ext.libraries = [
exclude(group: "com.google.guava", module: "guava")
exclude(group: "org.cryptacular", module: "cryptacular")
exclude(group: "commons-collections", module: "commons-collections")
exclude(group: "io.dropwizard.metrics", module: "metrics-core")
exclude(group: "net.shibboleth.utilities", module: "java-support")
exclude(group: "commons-codec", module: "commons-codec")
exclude(group: "commons-lang", module: "commons-lang")
Expand All @@ -2042,7 +2041,6 @@ ext.libraries = [
exclude(group: "com.google.code.findbugs", module: "jsr305")
exclude(group: "org.cryptacular", module: "cryptacular")
exclude(group: "commons-collections", module: "commons-collections")
exclude(group: "io.dropwizard.metrics", module: "metrics-core")
exclude(group: "net.shibboleth.utilities", module: "java-support")
exclude(group: "commons-codec", module: "commons-codec")
exclude(group: "commons-lang", module: "commons-lang")
Expand All @@ -2062,7 +2060,6 @@ ext.libraries = [
exclude(group: "com.google.guava", module: "guava")
exclude(group: "org.cryptacular", module: "cryptacular")
exclude(group: "commons-collections", module: "commons-collections")
exclude(group: "io.dropwizard.metrics", module: "metrics-core")
exclude(group: "net.shibboleth.utilities", module: "java-support")
exclude(group: "commons-codec", module: "commons-codec")
exclude(group: "commons-lang", module: "commons-lang")
Expand All @@ -2081,7 +2078,6 @@ ext.libraries = [
exclude(group: "com.google.guava", module: "guava")
exclude(group: "org.cryptacular", module: "cryptacular")
exclude(group: "commons-collections", module: "commons-collections")
exclude(group: "io.dropwizard.metrics", module: "metrics-core")
exclude(group: "com.google.code.findbugs", module: "jsr305")
exclude(group: "net.shibboleth.utilities", module: "java-support")
exclude(group: "commons-codec", module: "commons-codec")
Expand Down Expand Up @@ -2112,7 +2108,6 @@ ext.libraries = [
exclude(group: "com.google.guava", module: "guava")
exclude(group: "org.ldaptive", module: "ldaptive")
exclude(group: "org.cryptacular", module: "cryptacular")
exclude(group: "io.dropwizard.metrics", module: "metrics-core")
exclude(group: "net.shibboleth.utilities", module: "java-support")
exclude(group: "org.apache.velocity", module: "velocity")
exclude(group: "commons-lang", module: "commons-lang")
Expand Down
1 change: 1 addition & 0 deletions support/cas-server-support-pac4j-core-clients/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dependencies {
implementation libraries.pac4jcas
implementation libraries.nimbus
implementation libraries.opensaml
implementation libraries.dropwizard
implementation libraries.shibidpjavasupport

testImplementation project(path: ":core:cas-server-core-authentication", configuration: "tests")
Expand Down
1 change: 1 addition & 0 deletions support/cas-server-support-pac4j-webflow/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ dependencies {
implementation libraries.nimbus
implementation libraries.apachevelocity
implementation libraries.opensaml
implementation libraries.dropwizard
implementation libraries.shibidpjavasupport

testImplementation project(":core:cas-server-core-authentication-api")
Expand Down
1 change: 1 addition & 0 deletions support/cas-server-support-pac4j/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dependencies {
implementation libraries.jose4j
implementation libraries.shibidpjavasupport
implementation libraries.opensaml
implementation libraries.dropwizard

testImplementation project(path: ":core:cas-server-core-authentication", configuration: "tests")
testImplementation project(path: ":core:cas-server-core-authentication-api", configuration: "tests")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.boot.actuate.endpoint.annotation.Selector;
import org.springframework.boot.actuate.endpoint.annotation.WriteOperation;
import org.springframework.lang.Nullable;

import java.time.Duration;
import java.time.LocalDate;
Expand All @@ -36,26 +37,19 @@ public AuditLogEndpoint(final AuditTrailExecutionPlan auditTrailManager,
this.auditTrailManager = auditTrailManager;
}


/**
* Gets audit log.
*
* @return the audit log
*/
@ReadOperation
public Set<AuditActionContext> getAuditLog() {
val sinceDate = LocalDate.now(ZoneId.systemDefault()).minusDays(casProperties.getAudit().getNumberOfDaysInHistory());
return this.auditTrailManager.getAuditRecordsSince(sinceDate);
}

/**
* Gets Audit log for passed interval.
*
* @param interval - Interval subtracted from current time
* @return the auditlog
*/
@ReadOperation
public Set<AuditActionContext> getAuditLog(final @Selector String interval) {
public Set<AuditActionContext> getAuditLog(@Selector @Nullable final String interval) {
if (StringUtils.isBlank(interval)) {
val sinceDate = LocalDate.now(ZoneId.systemDefault()).minusDays(casProperties.getAudit().getNumberOfDaysInHistory());
return this.auditTrailManager.getAuditRecordsSince(sinceDate);
}

val duration = Duration.parse(interval);
val sinceTime = new Date(new Date().getTime() - duration.toMillis());
val days = duration.toDays();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.apereo.cas.services.RegisteredServiceTestUtils;

import lombok.val;
import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
Expand All @@ -18,7 +19,10 @@
* @author Misagh Moayyed
* @since 6.1.0
*/
@TestPropertySource(properties = "management.endpoint.auditLog.enabled=true")
@TestPropertySource(properties = {
"management.endpoint.auditLog.enabled=true",
"cas.audit.number-of-days-in-history=30"
})
public class AuditLogEndpointTests extends AbstractCasEndpointTests {
@Autowired
@Qualifier("auditLogEndpoint")
Expand All @@ -27,7 +31,14 @@ public class AuditLogEndpointTests extends AbstractCasEndpointTests {
@Test
public void verifyOperation() {
this.servicesManager.save(RegisteredServiceTestUtils.getRegisteredService(UUID.randomUUID().toString()));
val results = auditLogEndpoint.getAuditLog();
val results = auditLogEndpoint.getAuditLog(StringUtils.EMPTY);
assertFalse(results.isEmpty());
}

@Test
public void verifyOperationByInterval() {
this.servicesManager.save(RegisteredServiceTestUtils.getRegisteredService(UUID.randomUUID().toString()));
val results = auditLogEndpoint.getAuditLog("PT10M");
assertFalse(results.isEmpty());
}
}
1 change: 1 addition & 0 deletions support/cas-server-support-saml-core-api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
description = "Apereo CAS SAML Core Functionality"
dependencies {
api libraries.opensaml
api libraries.dropwizard
api libraries.bouncycastle
api libraries.jdom
api libraries.xmlapis
Expand Down
1 change: 1 addition & 0 deletions support/cas-server-support-saml-idp-discovery/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ dependencies {
implementation libraries.shibidp
implementation libraries.shibidpjavasupport
implementation libraries.opensaml
implementation libraries.dropwizard
implementation libraries.pac4jcore
implementation libraries.pac4jsaml
implementation libraries.nimbus
Expand Down
1 change: 1 addition & 0 deletions support/cas-server-support-saml-mdui-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies {
implementation project(":support:cas-server-support-saml-core")

implementation libraries.opensaml
implementation libraries.dropwizard
implementation libraries.shibidpjavasupport

testImplementation project(path: ":core:cas-server-core-services", configuration: "tests")
Expand Down
1 change: 1 addition & 0 deletions support/cas-server-support-saml-mdui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dependencies {
implementation project(":core:cas-server-core-services")

implementation libraries.opensaml
implementation libraries.dropwizard

testImplementation project(path: ":support:cas-server-support-saml", configuration: "tests")
testImplementation project(path: ":core:cas-server-core", configuration: "tests")
Expand Down
1 change: 1 addition & 0 deletions support/cas-server-support-saml/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
description = "Apereo CAS SAML Server and Validation Support"
dependencies {
implementation libraries.dropwizard
implementation libraries.opensaml
implementation libraries.shibidpjavasupport

Expand Down
1 change: 1 addition & 0 deletions support/cas-server-support-shell/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies {
implementation libraries.jasypt
implementation libraries.bouncycastle
implementation libraries.opensaml
implementation libraries.dropwizard
implementation libraries.javaparser

runtimeOnly project(":support:cas-server-support-jdbc-drivers")
Expand Down
1 change: 1 addition & 0 deletions support/cas-server-support-ws-idp-api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
description = "Apereo CAS WS-Security IdP API"
dependencies {
implementation libraries.opensaml
implementation libraries.dropwizard
implementation libraries.bouncycastle
implementation libraries.apachecxf
implementation libraries.apachefediz
Expand Down
1 change: 1 addition & 0 deletions support/cas-server-support-ws-idp/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
description = "Apereo CAS WS-Security IdP"
dependencies {
implementation libraries.opensaml
implementation libraries.dropwizard
implementation libraries.bouncycastle
implementation libraries.apachecxf
implementation libraries.apachefediz
Expand Down
1 change: 1 addition & 0 deletions support/cas-server-support-ws-sts-api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
description = "Apereo CAS WS-Security Secure Token Service"
dependencies {
implementation libraries.opensaml
implementation libraries.dropwizard
implementation libraries.bouncycastle
implementation libraries.apachecxf
implementation libraries.ehcache
Expand Down
1 change: 1 addition & 0 deletions support/cas-server-support-ws-sts/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
description = "Apereo CAS WS-Security Secure Token Service"
dependencies {
implementation libraries.opensaml
implementation libraries.dropwizard
implementation libraries.apachecxf
implementation libraries.bouncycastle

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dependencies {
api project(":api:cas-server-core-api-webflow")

implementation libraries.opensaml
implementation libraries.dropwizard
implementation libraries.shibidpjavasupport

implementation project(":support:cas-server-support-saml-core")
Expand Down
1 change: 1 addition & 0 deletions support/cas-server-support-wsfederation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dependencies {
api project(":api:cas-server-core-api-cookie")

implementation libraries.opensaml
implementation libraries.dropwizard
implementation libraries.shibidpjavasupport

implementation project(":core:cas-server-core-web-api")
Expand Down

0 comments on commit 6d57f72

Please sign in to comment.