Skip to content

Commit

Permalink
Merge branch 'master' into feature/new-ws
Browse files Browse the repository at this point in the history
  • Loading branch information
virgo47 committed Feb 5, 2020
2 parents 97ad6aa + 3bc2171 commit d1f4589
Show file tree
Hide file tree
Showing 52 changed files with 2,123 additions and 302 deletions.
9 changes: 5 additions & 4 deletions dist/javadoc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>dist</artifactId>
<groupId>com.evolveum.midpoint</groupId>
<version>4.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>javadoc</artifactId>
Expand All @@ -21,11 +23,9 @@
<name>midPoint JavaDoc</name>

<properties>
<!--
module doesn't have main/src, without this we'd get:
The packaging for this project did not assign a file to the build artifact
-->
<!-- see notes in main midPoint POM -->
<maven.install.skip>true</maven.install.skip>
<maven.deploy.skip>true</maven.deploy.skip>
<maven.test.skip>true</maven.test.skip>
</properties>

Expand Down Expand Up @@ -106,6 +106,7 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>java8</id>
Expand Down
1 change: 1 addition & 0 deletions dist/midpoint-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<artifactId>dist</artifactId>
<groupId>com.evolveum.midpoint</groupId>
<version>4.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>midpoint-api</artifactId>
Expand Down
34 changes: 18 additions & 16 deletions dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@

<name>midPoint Distribution</name>

<modules>
<module>midpoint-api</module>
<module>javadoc</module>
</modules>

<dependencies>
<dependency>
<dependency>
<groupId>com.evolveum.midpoint.gui</groupId>
<artifactId>admin-gui</artifactId>
<version>4.1-SNAPSHOT</version>
Expand Down Expand Up @@ -50,6 +55,7 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -92,26 +98,22 @@
<artifactId>maven-assembly-plugin</artifactId>
<inherited>false</inherited>
<configuration>
<descriptors>
<descriptor>src/main/assembly/dist.xml</descriptor>
</descriptors>
<finalName>midpoint-${project.version}</finalName>
<descriptors>
<descriptor>src/main/assembly/dist.xml</descriptor>
</descriptors>
<finalName>midpoint-${project.version}</finalName>
<tarLongFileMode>gnu</tarLongFileMode>
</configuration>
<executions>
<execution>
<id>dist-assembly</id>
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
<execution>
<id>dist-assembly</id>
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<modules>
<module>midpoint-api</module>
<module>javadoc</module>
</modules>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
</tr>
<tr>
<td><wicket:message key="ObjectDeltaOperationType.executionResult" /></td>
<td><span wicket:id="executionResult" /></td>
<td><div wicket:id="executionResult" class="pull-left"/>
<div wicket:id="fullResultLink" class="show-empty-button pull-right" /></td>
</tr>
</table>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@
*/
package com.evolveum.midpoint.gui.api.component.delta;

import com.evolveum.midpoint.gui.api.component.result.OperationResultPopupPanel;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.util.DebugUtil;
import com.evolveum.midpoint.util.logging.LoggingUtils;
import com.evolveum.midpoint.web.component.AjaxButton;
import com.evolveum.midpoint.web.component.util.VisibleBehaviour;
import com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;

import com.evolveum.midpoint.gui.api.component.BasePanel;
Expand All @@ -40,6 +46,7 @@ public class ObjectDeltaOperationPanel extends BasePanel<ObjectDeltaOperationTyp

private static final String ID_PARAMETERS_DELTA = "delta";
private static final String ID_PARAMETERS_EXECUTION_RESULT = "executionResult";
private static final String ID_PARAMETERS_FULL_RESULT_LINK = "fullResultLink";
private static final String ID_PARAMETERS_OBJECT_NAME = "objectName";
private static final String ID_PARAMETERS_RESOURCE_NAME = "resourceName";

Expand Down Expand Up @@ -73,6 +80,24 @@ public String getObject() {
executionResult.setOutputMarkupId(true);
objectDeltaOperationMarkup.add(executionResult);

AjaxButton showFullResultsLink = new AjaxButton(ID_PARAMETERS_FULL_RESULT_LINK) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
showFullResultsPerformed(target);
}

@Override
public IModel<?> getBody() {
return getPageBase().createStringResource("ObjectDeltaOperationResult.showFullResult");
}
};
showFullResultsLink.setOutputMarkupId(true);
showFullResultsLink.add(AttributeAppender.append("style", "cursor: pointer;"));
showFullResultsLink.add(new VisibleBehaviour(() -> !WebComponentUtil.isSuccessOrHandledError(getModelObject() != null ?
getModelObject().getExecutionResult() : null)));
objectDeltaOperationMarkup.add(showFullResultsLink);

Label resourceName = new Label(ID_PARAMETERS_RESOURCE_NAME,
new PropertyModel(getModel(), ObjectDeltaOperationType.F_RESOURCE_NAME.getLocalPart()));
resourceName.setOutputMarkupId(true);
Expand Down Expand Up @@ -168,4 +193,10 @@ private SceneDto loadSceneForDelta() throws SchemaException, ExpressionEvaluatio

}

private void showFullResultsPerformed(AjaxRequestTarget target){
OperationResultPopupPanel operationResultPopupPanel = new OperationResultPopupPanel(getPageBase().getMainPopupBodyId(),
getModelObject() != null ? Model.of(OperationResult.createOperationResult(getModelObject().getExecutionResult()))
: Model.of());
getPageBase().showMainPopup(operationResultPopupPanel, target);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!--
~ Copyright (c) 2019 Evolveum
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<html xmlns:wicket="http://wicket.apache.org">
<body>
<wicket:panel>
<div wicket:id="operationResultsPanel" />
</wicket:panel>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Copyright (c) 2020 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.gui.api.component.result;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.web.component.dialog.Popupable;

import org.apache.wicket.Component;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.StringResourceModel;

/**
* @author honchar
*/
public class OperationResultPopupPanel extends BasePanel<OperationResult> implements Popupable {
private static final long serialVersionUID = 1L;

private static final String ID_OPERATION_RESULTS_PANEL = "operationResultsPanel";

public OperationResultPopupPanel(String id, IModel<OperationResult> model){
super(id, model);
}

@Override
protected void onInitialize(){
super.onInitialize();

OperationResultPanel operationResultPanel = new OperationResultPanel(ID_OPERATION_RESULTS_PANEL,
Model.of(OpResult.getOpResult(getPageBase(), getModelObject())), getPageBase());
operationResultPanel.setOutputMarkupId(true);
add(operationResultPanel);
}

@Override
public int getWidth() {
return 800;
}

@Override
public int getHeight() {
return 600;
}

@Override
public String getWidthUnit(){
return "px";
}

@Override
public String getHeightUnit(){
return "px";
}

@Override
public StringResourceModel getTitle() {
return new StringResourceModel("OperationResultPopupPanel.title");
}

@Override
public Component getComponent() {
return this;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
*/
package com.evolveum.midpoint.web.security;

import com.evolveum.midpoint.web.security.util.MidpointSamlLocalServiceProviderConfiguration;

import org.springframework.security.saml.SamlMetadataCache;
import org.springframework.security.saml.SamlTransformer;
import org.springframework.security.saml.SamlValidator;
import org.springframework.security.saml.key.KeyType;
import org.springframework.security.saml.key.SimpleKey;
import org.springframework.security.saml.provider.config.LocalProviderConfiguration;
import org.springframework.security.saml.provider.config.SamlConfigurationRepository;
import org.springframework.security.saml.provider.provisioning.HostBasedSamlServiceProviderProvisioning;
import org.springframework.security.saml.provider.service.AuthenticationRequestEnhancer;
Expand Down Expand Up @@ -90,4 +93,15 @@ protected ServiceProviderService getHostedServiceProvider(LocalServiceProviderCo
authnRequestEnhancer
);
}

@Override
protected String getAliasPath(LocalProviderConfiguration configuration) {
if (configuration instanceof MidpointSamlLocalServiceProviderConfiguration) {
String alias = ((MidpointSamlLocalServiceProviderConfiguration) configuration).getAliasForPath();
if (hasText(alias)) {
return alias;
}
}
return super.getAliasPath(configuration);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.security.util.KeyStoreKey;
import com.evolveum.midpoint.web.security.util.MidpointSamlLocalServiceProviderConfiguration;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType;
import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -79,7 +80,7 @@ private static SamlModuleWebSecurityConfiguration buildInternal(AuthenticationMo
samlConfiguration.setNetwork(network);
}
AuthenticationModuleSaml2ServiceProviderType serviceProviderType = modelType.getServiceProvider();
LocalServiceProviderConfiguration serviceProvider = new LocalServiceProviderConfiguration();
MidpointSamlLocalServiceProviderConfiguration serviceProvider = new MidpointSamlLocalServiceProviderConfiguration();
serviceProvider.setEntityId(serviceProviderType.getEntityId())
.setSignMetadata(Boolean.TRUE.equals(serviceProviderType.isSignRequests()))
.setSignRequests(Boolean.TRUE.equals(serviceProviderType.isSignRequests()))
Expand Down Expand Up @@ -137,6 +138,8 @@ private static SamlModuleWebSecurityConfiguration buildInternal(AuthenticationMo
}
}
serviceProvider.setKeys(key);
serviceProvider.setAlias(serviceProviderType.getAlias());
serviceProvider.setAliasForPath(serviceProviderType.getAliasForPath());

List<ExternalIdentityProviderConfiguration> providers = new ArrayList<ExternalIdentityProviderConfiguration>();
List<AuthenticationModuleSaml2ProviderType> providersType = serviceProviderType.getProvider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ protected Authentication internalAuthentication(Authentication authentication, L
List<Attribute> attributes = ((DefaultSamlAuthentication) authentication).getAssertion().getAttributes();
String enteredUsername = "";
for (Attribute attribute : attributes) {
if (attribute.getFriendlyName().equals(samlModule.getNamesOfUsernameAttributes().get(samlAuthentication.getAssertingEntityId()))) {
if (attribute != null
&& ((attribute.getFriendlyName() != null && attribute.getFriendlyName().equals(samlModule.getNamesOfUsernameAttributes().get(samlAuthentication.getAssertingEntityId())))
|| (attribute.getName() != null && attribute.getName().equals(samlModule.getNamesOfUsernameAttributes().get(samlAuthentication.getAssertingEntityId()))))){
List<Object> values = attribute.getValues();
if (values == null) {
LOGGER.error("Saml attribute, which define username don't contains value");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2010-2019 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.web.security.util;

import org.springframework.security.saml.provider.service.config.LocalServiceProviderConfiguration;

/**
* @author skublik
*/

public class MidpointSamlLocalServiceProviderConfiguration extends LocalServiceProviderConfiguration {

private String aliasForPath;

public String getAliasForPath() {
return aliasForPath;
}

public void setAliasForPath(String aliasForPath) {
this.aliasForPath = aliasForPath;
}
}
Loading

0 comments on commit d1f4589

Please sign in to comment.