Skip to content

Commit

Permalink
Merge branch 'support-4.1' of https://github.com/Evolveum/midpoint in…
Browse files Browse the repository at this point in the history
…to support-4.1
  • Loading branch information
KaterynaHonchar committed Jun 5, 2020
2 parents 71bd125 + b1f89a0 commit 5b7c954
Show file tree
Hide file tree
Showing 23 changed files with 304 additions and 345 deletions.
2 changes: 1 addition & 1 deletion gui/admin-gui/pom.xml
Expand Up @@ -803,7 +803,7 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>

Expand Down
Expand Up @@ -57,6 +57,9 @@ public PrismContainerValueWrapper<ConstructionType> createContainerValueWrapper(
}

ObjectReferenceType resourceRef = constructionType.getResourceRef();
if (resourceRef.getOid() == null) {
return constructionValueWrapper;
}

PrismObject<ResourceType> resource = null;
try {
Expand Down
Expand Up @@ -24,9 +24,16 @@
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementWebServerFactoryCustomizer;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.boot.autoconfigure.web.embedded.JettyWebServerFactoryCustomizer;
import org.springframework.boot.autoconfigure.web.embedded.NettyWebServerFactoryCustomizer;
import org.springframework.boot.autoconfigure.web.embedded.TomcatWebServerFactoryCustomizer;
import org.springframework.boot.autoconfigure.web.embedded.UndertowWebServerFactoryCustomizer;
import org.springframework.boot.autoconfigure.web.reactive.ReactiveWebServerFactoryCustomizer;
import org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryCustomizer;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.embedded.tomcat.TomcatContextCustomizer;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
Expand All @@ -39,6 +46,7 @@
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.annotation.Profile;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpStatus;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.annotation.EnableScheduling;
Expand Down Expand Up @@ -169,39 +177,30 @@ public void invalidExpiredSessions() {

@Component
@EnableConfigurationProperties(ServerProperties.class)
public class ServerCustomization implements WebServerFactoryCustomizer<ConfigurableServletWebServerFactory> {
public class ServerCustomization implements WebServerFactoryCustomizer<MidPointTomcatServletWebServerFactory> {

@Value("${server.servlet.session.timeout}")
private int sessionTimeout;
@Value("${server.servlet.context-path}")
private String servletPath;

@Value("${server.use-forward-headers:false}")
private Boolean useForwardHeaders;

@Value("${server.tomcat.internal-proxies:@null}")
private String internalProxies;

@Value("${server.tomcat.protocol-header:@null}")
private String protocolHeader;

@Value("${server.tomcat.protocol-header-https-value:@null}")
private String protocolHeaderHttpsValue;

@Value("${server.tomcat.port-header:@null}")
private String portHeader;

@Autowired
private ServerProperties serverProperties;

@Autowired
private TaskManager taskManager;

@Autowired
private Environment env;


@Override
public void customize(ConfigurableServletWebServerFactory serverFactory) {
public void customize(MidPointTomcatServletWebServerFactory serverFactory) {

ServletWebServerFactoryCustomizer servletWebServerFactoryCustomizer = new ServletWebServerFactoryCustomizer(serverProperties);
servletWebServerFactoryCustomizer.customize(serverFactory);
ServletWebServerFactoryCustomizer webServletWebServerFactoryCustomizer = new ServletWebServerFactoryCustomizer(serverProperties);
webServletWebServerFactoryCustomizer.customize(serverFactory);
TomcatWebServerFactoryCustomizer tomcatWebServerFactoryCustomizer = new TomcatWebServerFactoryCustomizer(env, serverProperties);
tomcatWebServerFactoryCustomizer.customize(serverFactory);

serverFactory.addErrorPages(new ErrorPage(HttpStatus.UNAUTHORIZED, "/error/401"));
serverFactory.addErrorPages(new ErrorPage(HttpStatus.FORBIDDEN, "/error/403"));
Expand All @@ -214,47 +213,24 @@ public void customize(ConfigurableServletWebServerFactory serverFactory) {
serverFactory.setSession(session);

if (serverFactory instanceof TomcatServletWebServerFactory) {
customizeTomcat((TomcatServletWebServerFactory) serverFactory);
TomcatContextCustomizer contextCustomizer = new TomcatContextCustomizer() {
@Override
public void customize(Context context) {
setTomcatContext(context);
}
};
List<TomcatContextCustomizer> contextCustomizers = new ArrayList<>();
contextCustomizers.add(contextCustomizer);
serverFactory.setTomcatContextCustomizers(contextCustomizers);

// Tomcat valve used to redirect root URL (/) to real application URL (/midpoint/).
// See comments in TomcatRootValve
Valve rootValve = new TomcatRootValve(servletPath);
serverFactory.addEngineValves(rootValve);

Valve nodeIdHeaderValve = new NodeIdHeaderValve(taskManager);
serverFactory.addEngineValves(nodeIdHeaderValve);
}
}

private void customizeTomcat(TomcatServletWebServerFactory tomcatFactory) {
// set tomcat context.
TomcatContextCustomizer contextCustomizer = new TomcatContextCustomizer() {
@Override
public void customize(Context context) {
setTomcatContext(context);
}
};
List<TomcatContextCustomizer> contextCustomizers = new ArrayList<>();
contextCustomizers.add(contextCustomizer);
tomcatFactory.setTomcatContextCustomizers(contextCustomizers);

// Tomcat valve used to redirect root URL (/) to real application URL (/midpoint/).
// See comments in TomcatRootValve
Valve rootValve = new TomcatRootValve(servletPath);
tomcatFactory.addEngineValves(rootValve);

Valve nodeIdHeaderValve = new NodeIdHeaderValve(taskManager);
tomcatFactory.addEngineValves(nodeIdHeaderValve);

if (useForwardHeaders) {
RemoteIpValve remoteIpValve = new RemoteIpValve();
if (StringUtils.isNotEmpty(internalProxies)) {
remoteIpValve.setInternalProxies(internalProxies);
}
if (StringUtils.isNotEmpty(protocolHeader)) {
remoteIpValve.setProtocolHeader(protocolHeader);
}
if (StringUtils.isNotEmpty(protocolHeaderHttpsValue)) {
remoteIpValve.setProtocolHeaderHttpsValue(protocolHeaderHttpsValue);
}
if (StringUtils.isNotEmpty(portHeader)) {
remoteIpValve.setPortHeader(portHeader);
}
tomcatFactory.addEngineValves(remoteIpValve);
}
}

}
}
Expand Up @@ -29,8 +29,6 @@ public class DropDownChoicePanel<T> extends InputPanel {
private static final long serialVersionUID = 1L;
private static final String ID_INPUT = "input";

private boolean sortChoices = true;

public DropDownChoicePanel(String id, IModel<T> model, IModel<? extends List<? extends T>> choices) {
this(id, model, choices, false);
}
Expand Down Expand Up @@ -66,16 +64,6 @@ protected String getNullValidDisplayValue() {
return DropDownChoicePanel.this.getNullValidDisplayValue();
}

@Override
public IModel<? extends List<? extends T>> getChoicesModel() {
IModel<? extends List<? extends T>> choices = super.getChoicesModel();
if (sortChoices) {
return Model.ofList(WebComponentUtil.sortDropDownChoices(choices, renderer));
} else {
return choices;
}
}

@Override
public String getModelValue() {
T object = this.getModelObject();
Expand Down Expand Up @@ -108,12 +96,4 @@ public IModel<T> getModel() {
protected String getNullValidDisplayValue() {
return getString("DropDownChoicePanel.notDefined");
}

public boolean isSortChoices() {
return sortChoices;
}

public void setSortChoices(boolean sortChoices) {
this.sortChoices = sortChoices;
}
}
Expand Up @@ -116,63 +116,55 @@ private void initLayout() {
GenericTraceVisualizationType.class, ID_CLOCKWORK_EXECUTION, createClockworkLevels(),
new PropertyModel<>(model, TraceViewDto.F_CLOCKWORK_EXECUTION),
this, false);
clockworkExecutionChoice.setSortChoices(false);
clockworkExecutionChoice.setOutputMarkupId(true);
mainForm.add(clockworkExecutionChoice);

DropDownChoicePanel<GenericTraceVisualizationType> clockworkClickChoice = WebComponentUtil.createEnumPanel(
GenericTraceVisualizationType.class, ID_CLOCKWORK_CLICK, createClockworkLevels(),
new PropertyModel<>(model, TraceViewDto.F_CLOCKWORK_CLICK),
this, false);
clockworkClickChoice.setSortChoices(false);
clockworkClickChoice.setOutputMarkupId(true);
mainForm.add(clockworkClickChoice);

DropDownChoicePanel<GenericTraceVisualizationType> mappingEvaluationChoice = WebComponentUtil.createEnumPanel(
GenericTraceVisualizationType.class, ID_MAPPING_EVALUATION, createMappingLevels(),
new PropertyModel<>(model, TraceViewDto.F_MAPPING_EVALUATION),
this, false);
mappingEvaluationChoice.setSortChoices(false);
mappingEvaluationChoice.setOutputMarkupId(true);
mainForm.add(mappingEvaluationChoice);

DropDownChoicePanel<GenericTraceVisualizationType> focusLoadChoice = WebComponentUtil.createEnumPanel(
GenericTraceVisualizationType.class, ID_FOCUS_LOAD, createStandardLevels(),
new PropertyModel<>(model, TraceViewDto.F_FOCUS_LOAD),
this, false);
focusLoadChoice.setSortChoices(false);
focusLoadChoice.setOutputMarkupId(true);
mainForm.add(focusLoadChoice);

DropDownChoicePanel<GenericTraceVisualizationType> projectionLoadChoice = WebComponentUtil.createEnumPanel(
GenericTraceVisualizationType.class, ID_PROJECTION_LOAD, createStandardLevels(),
new PropertyModel<>(model, TraceViewDto.F_PROJECTION_LOAD),
this, false);
projectionLoadChoice.setSortChoices(false);
projectionLoadChoice.setOutputMarkupId(true);
mainForm.add(projectionLoadChoice);

DropDownChoicePanel<GenericTraceVisualizationType> focusChangeChoice = WebComponentUtil.createEnumPanel(
GenericTraceVisualizationType.class, ID_FOCUS_CHANGE, createStandardLevels(),
new PropertyModel<>(model, TraceViewDto.F_FOCUS_CHANGE),
this, false);
focusChangeChoice.setSortChoices(false);
focusChangeChoice.setOutputMarkupId(true);
mainForm.add(focusChangeChoice);

DropDownChoicePanel<GenericTraceVisualizationType> projectionChangeChoice = WebComponentUtil.createEnumPanel(
GenericTraceVisualizationType.class, ID_PROJECTION_CHANGE, createStandardLevels(),
new PropertyModel<>(model, TraceViewDto.F_PROJECTION_CHANGE),
this, false);
projectionChangeChoice.setSortChoices(false);
projectionChangeChoice.setOutputMarkupId(true);
mainForm.add(projectionChangeChoice);

DropDownChoicePanel<GenericTraceVisualizationType> otherChoice = WebComponentUtil.createEnumPanel(
GenericTraceVisualizationType.class, ID_OTHERS, createOthersLevels(),
new PropertyModel<>(model, TraceViewDto.F_OTHERS),
this, false);
otherChoice.setSortChoices(false);
otherChoice.setOutputMarkupId(true);
mainForm.add(otherChoice);

Expand Down
5 changes: 5 additions & 0 deletions infra/schema/pom.xml
Expand Up @@ -273,6 +273,11 @@
</extraargs>
</wsdlOption>
</wsdlOptions>
<!--
This avoids going online for schema checking which may slow down the build sometimes extremely,
e.g. when firewall is set to drop SYN packet silently during connection.
-->
<additionalJvmArgs>-Dcom.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.noCorrectnessCheck=true</additionalJvmArgs>
</configuration>
<goals>
<goal>wsdl2java</goal>
Expand Down
2 changes: 1 addition & 1 deletion model/certification-impl/pom.xml
Expand Up @@ -267,7 +267,7 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<artifactId>javax.servlet-api</artifactId>
<scope>test</scope>
</dependency>
<dependency> <!-- needed as runtime dependency otherwise spring won't start -->
Expand Down
2 changes: 1 addition & 1 deletion model/model-api/pom.xml
Expand Up @@ -100,7 +100,7 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<artifactId>javax.servlet-api</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion model/model-impl/pom.xml
Expand Up @@ -386,7 +386,7 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<artifactId>javax.servlet-api</artifactId>
<!-- TODO: compile scope for ModelRestService - I think it should go to more infrastructural module (Virgo) -->
<!--<scope>test</scope>-->
</dependency>
Expand Down
2 changes: 1 addition & 1 deletion model/model-intest/pom.xml
Expand Up @@ -267,7 +267,7 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<artifactId>javax.servlet-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion model/model-test/pom.xml
Expand Up @@ -182,7 +182,7 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.forgerock.opendj</groupId>
Expand Down
2 changes: 1 addition & 1 deletion model/notifications-impl/pom.xml
Expand Up @@ -236,7 +236,7 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<artifactId>javax.servlet-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion model/report-impl/pom.xml
Expand Up @@ -298,7 +298,7 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<artifactId>javax.servlet-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion model/workflow-impl/pom.xml
Expand Up @@ -282,7 +282,7 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<artifactId>javax.servlet-api</artifactId>
<scope>test</scope>
</dependency>
<dependency> <!-- needed as runtime dependency otherwise spring won't start -->
Expand Down
9 changes: 6 additions & 3 deletions pom.xml
Expand Up @@ -537,7 +537,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
<version>2.6</version>
<version>2.7</version>
<exclusions>
<!-- replaced by org.slf4j:jcl-over-slf4j -->
<exclusion>
Expand Down Expand Up @@ -605,8 +605,8 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -1826,6 +1826,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<deployAtEnd>true</deployAtEnd>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.m2e</groupId>
Expand Down
2 changes: 1 addition & 1 deletion repo/security-api/pom.xml
Expand Up @@ -59,7 +59,7 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
2 changes: 1 addition & 1 deletion repo/security-enforcer-api/pom.xml
Expand Up @@ -53,7 +53,7 @@

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
</dependencies>
</project>

0 comments on commit 5b7c954

Please sign in to comment.