Skip to content

Commit

Permalink
fix compile issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoayyed committed May 31, 2018
1 parent fc06b5d commit e9ff963
Show file tree
Hide file tree
Showing 923 changed files with 2,063 additions and 3,337 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,36 @@
public class AuthenticationTransactionTests {
@Test
public void verifyHasCredentialOfTypeSingle() {
final var transaction = AuthenticationTransaction.of(new TestCredentialType1());
final var transaction = DefaultAuthenticationTransaction.of(new TestCredentialType1());
assertTrue(transaction.hasCredentialOfType(BaseTestCredential.class));
assertTrue(transaction.hasCredentialOfType(TestCredentialType1.class));
assertFalse(transaction.hasCredentialOfType(TestCredentialType2.class));
}

@Test
public void verifyHasCredentialOfTypeMultiple() {
final var transaction = AuthenticationTransaction
final var transaction = DefaultAuthenticationTransaction.of(new TestCredentialType2(), new TestCredentialType1());
assertTrue(transaction.hasCredentialOfType(BaseTestCredential.class));
assertTrue(transaction.hasCredentialOfType(TestCredentialType1.class));
assertTrue(transaction.hasCredentialOfType(TestCredentialType2.class));
}

private abstract static class BaseTestCredential implements Credential {
private static final long serialVersionUID = -6933725969701066361L;
}

private static class TestCredentialType1 extends BaseTestCredential {
private static final long serialVersionUID = -2785558255024055757L;

@Override
public String getId() {
return null;
}
}

private static class TestCredentialType2 implements Credential {
private static final long serialVersionUID = -4137096818705980020L;

@Override
public String getId() {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.javaparser.JavaParser;
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.Modifier;
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
import com.github.javaparser.ast.body.FieldDeclaration;
import com.github.javaparser.ast.body.VariableDeclarator;
import com.github.javaparser.ast.expr.BooleanLiteralExpr;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.expr.LiteralStringValueExpr;
import com.github.javaparser.ast.type.ClassOrInterfaceType;
import com.github.javaparser.ast.visitor.VoidVisitorAdapter;
Expand Down Expand Up @@ -43,7 +40,6 @@
import org.springframework.util.ReflectionUtils;

import java.io.File;
import java.io.InputStream;
import java.io.Serializable;
import java.nio.file.Files;
import java.nio.file.Paths;
Expand All @@ -54,9 +50,7 @@
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
Expand Down Expand Up @@ -119,7 +113,7 @@ public void execute() throws Exception {
}
final var mapper = new ObjectMapper().findAndRegisterModules();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
final TypeReference<Map<String, Set<ConfigurationMetadataProperty>>> values = new TypeReference<Map<String, Set<ConfigurationMetadataProperty>>>() {
final TypeReference<Map<String, Set<ConfigurationMetadataProperty>>> values = new TypeReference<>() {
};
final Map<String, Set> jsonMap = mapper.readValue(jsonFile, values);
final Set<ConfigurationMetadataProperty> properties = jsonMap.get("properties");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.apereo.cas.configuration.model.core.monitor;

import lombok.Getter;
import lombok.Setter;
import org.apereo.cas.configuration.model.support.ConnectionPoolingProperties;
import org.apereo.cas.configuration.model.support.jpa.AbstractJpaProperties;
import org.apereo.cas.configuration.model.support.ldap.AbstractLdapProperties;
Expand All @@ -10,17 +12,13 @@

import java.io.Serializable;

import lombok.Getter;
import lombok.Setter;

/**
* Configuration properties class for cas.monitor.
*
* @author Dmitriy Kopylenko
* @since 5.0.0
*/
@RequiresModule(name = "cas-server-core-monitor", automated = true)

@Getter
@Setter
public class MonitorProperties implements Serializable {
Expand Down Expand Up @@ -50,6 +48,15 @@ public class MonitorProperties implements Serializable {
@NestedConfigurationProperty
private MonitorWarningProperties warn = new MonitorWarningProperties();


/**
* Options for monitoring sensitive CAS endpoints and resources.
* Acts as a parent class for all endpoints and settings
* and exposes shortcuts so security and capability of endpoints
* can be globally controlled from one spot and then overridden elsewhere.
*/
private Endpoints endpoints = new Endpoints();

/**
* Options for monitoring JDBC resources.
*/
Expand Down Expand Up @@ -152,5 +159,203 @@ public static class Jdbc extends AbstractJpaProperties {
*/
private String maxWait = "PT5S";
}


/**
* All endpoints are modeled after
* Spring Boot’s own actuator endpoints and by default are considered sensitive.
* By default, no endpoint is enabled or allowed access.
* Endpoints may go through multiple levels and layers of security.
*/
@Setter
@Getter
public abstract static class BaseEndpoint {

/**
* Disable access to the endpoint completely.
*/
private Boolean enabled;

/**
* Marking the endpoint as sensitive will force it to require authentication.
* The authentication scheme usually is done via the presence of spring security
* related modules who then handle the protocol and verifications of credentials.
* If you wish to choose alternative methods for endpoint security, such as letting
* CAS handle the sensitivity of the endpoint itself via CAS itself or via
* IP pattern checking, etc, set this flag to false. For more elaborate means of authenticating
* into an endpoint such as basic authn and verifications credentials with a master account, LDAP, JDBC, etc
* set this endpoint to true and configure spring security appropriate as is described by the docs.
* <p>
* By default all endpoints are considered disabled and sensitive.
* <p>
* <p>It's important to note that these endpoints and their settings only affect
* what CAS provides. Additional endpoints provided by Spring Boot are controlled
* elsewhere by Spring Boot itself.</p>
*/
private Boolean sensitive;
}

@RequiresModule(name = "cas-server-support-reports", automated = true)
@Getter
@Setter
public static class Endpoints extends BaseEndpoint {

/**
* Dashboard related settings.
*/
private Dashboard dashboard = new Dashboard();

/**
* Audit events related settings.
*/
private AuditEvents auditEvents = new AuditEvents();

/**
* Authentication events related settings.
*/
private AuthenticationEvents authenticationEvents = new AuthenticationEvents();

/**
* Configuration State related settings.
*/
private ConfigurationState configurationState = new ConfigurationState();

/**
* Health check related settings.
*/
private HealthCheck healthCheck = new HealthCheck();

/**
* Logging configuration related settings.
*/
private LoggingConfig loggingConfig = new LoggingConfig();

/**
* Metrics related settings.
*/
private Metrics metrics = new Metrics();

/**
* Attribute resolution related settings.
*/
private AttributeResolution attributeResolution = new AttributeResolution();

/**
* Single Sign on sessions report related settings.
*/
private SingleSignOnReport singleSignOnReport = new SingleSignOnReport();

/**
* Statistics related settings.
*/
private Statistics statistics = new Statistics();

/**
* Discovery related settings.
*/
private Discovery discovery = new Discovery();

/**
* Trusted devices related settings.
*/
private TrustedDevices trustedDevices = new TrustedDevices();

/**
* Status related settings.
*/
private Status status = new Status();

/**
* Single Sign On Status related settings.
*/
private SingleSignOnStatus singleSignOnStatus = new SingleSignOnStatus();

/**
* Spring webflow related settings.
*/
private SpringWebflowReport springWebflowReport = new SpringWebflowReport();

/**
* Registered services and service registry related settings.
*/
private RegisteredServicesReport registeredServicesReport = new RegisteredServicesReport();

/**
* Configuration metadata, documentation and fields, etc.
*/
private ConfigurationMetadata configurationMetadata = new ConfigurationMetadata();

public Endpoints() {
setSensitive(Boolean.TRUE);
setEnabled(Boolean.FALSE);
}

@RequiresModule(name = "cas-server-support-reports", automated = true)
public static class Dashboard extends BaseEndpoint {
}

@RequiresModule(name = "cas-server-support-reports", automated = true)
public static class AuditEvents extends BaseEndpoint {
}

@RequiresModule(name = "cas-server-support-reports", automated = true)
public static class AuthenticationEvents extends BaseEndpoint {
}

@RequiresModule(name = "cas-server-core-configuration", automated = true)
public static class ConfigurationState extends BaseEndpoint {
}

@RequiresModule(name = "cas-server-core-monitor", automated = true)
public static class HealthCheck extends BaseEndpoint {
}

@RequiresModule(name = "cas-server-core-logging", automated = true)
public static class LoggingConfig extends BaseEndpoint {
}

@RequiresModule(name = "cas-server-support-metrics", automated = true)
public static class Metrics extends BaseEndpoint {
}

@RequiresModule(name = "cas-server-support-person-directory", automated = true)
public static class AttributeResolution extends BaseEndpoint {
}

@RequiresModule(name = "cas-server-core-web", automated = true)
public static class SingleSignOnReport extends BaseEndpoint {
}

@RequiresModule(name = "cas-server-core-web", automated = true)
public static class Statistics extends BaseEndpoint {
}

@RequiresModule(name = "cas-server-support-mfa-trusted", automated = true)
public static class TrustedDevices extends BaseEndpoint {
}

@RequiresModule(name = "cas-server-core-web", automated = true)
public static class Status extends BaseEndpoint {
}

@RequiresModule(name = "cas-server-support-discovery", automated = true)
public static class Discovery extends BaseEndpoint {
}

@RequiresModule(name = "cas-server-core", automated = true)
public static class SingleSignOnStatus extends BaseEndpoint {
}

@RequiresModule(name = "cas-server-core-webflow", automated = true)
public static class SpringWebflowReport extends BaseEndpoint {
}

@RequiresModule(name = "cas-server-core-services", automated = true)
public static class RegisteredServicesReport extends BaseEndpoint {
}

@RequiresModule(name = "cas-server-core-configuration", automated = true)
public static class ConfigurationMetadata extends BaseEndpoint {
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import org.apereo.cas.support.events.AbstractCasEvent;
import java.io.File;

import java.nio.file.Path;
import java.util.regex.Pattern;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.function.Predicate;

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ subprojects {
}
}
}

dependencies {
optional libraries.springcomponentindexer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.springframework.context.ApplicationContext;
import org.springframework.context.i18n.LocaleContextHolder;

import java.util.Locale;
import java.util.stream.Collectors;
import java.util.stream.Stream;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apereo.cas.audit.AuditPrincipalIdProvider;
import org.apereo.cas.authentication.Authentication;
import org.apereo.cas.authentication.AuthenticationCredentialsThreadLocalBinder;
import org.apereo.inspektr.common.spi.PrincipalResolver;
import org.aspectj.lang.JoinPoint;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package org.apereo.cas.audit.spi;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import lombok.extern.slf4j.Slf4j;
import org.apereo.cas.authentication.Authentication;
import org.apereo.cas.util.AopUtils;
import org.apereo.cas.validation.Assertion;
import org.aspectj.lang.JoinPoint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import org.apereo.cas.audit.spi.TicketAsFirstParameterResourceResolver;
import org.apereo.cas.audit.spi.TicketValidationResourceResolver;
import org.apereo.cas.configuration.CasConfigurationProperties;
import org.apereo.cas.configuration.model.core.audit.AuditProperties;
import org.apereo.cas.configuration.model.core.audit.AuditSlf4jLogProperties;
import org.apereo.cas.util.CollectionUtils;
import org.apereo.inspektr.audit.AuditTrailManagementAspect;
import org.apereo.inspektr.audit.spi.AuditActionResolver;
Expand Down
Loading

0 comments on commit e9ff963

Please sign in to comment.