Skip to content

Commit

Permalink
Fixed WSS4J version on master + added a few lambdas in the SAML SSO code
Browse files Browse the repository at this point in the history
  • Loading branch information
coheigea committed Aug 1, 2017
1 parent 508c8cc commit 2f18275
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
*/
package org.apache.syncope.core.rest.cxf.service;

import java.io.IOException;
import java.io.OutputStream;

import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
Expand All @@ -42,13 +39,8 @@ public class SAML2SPServiceImpl extends AbstractServiceImpl implements SAML2SPSe

@Override
public Response getMetadata(final String spEntityID, final String urlContext) {
StreamingOutput sout = new StreamingOutput() {
StreamingOutput sout = (os) -> logic.getMetadata(StringUtils.appendIfMissing(spEntityID, "/"), urlContext, os);

@Override
public void write(final OutputStream os) throws IOException {
logic.getMetadata(StringUtils.appendIfMissing(spEntityID, "/"), urlContext, os);
}
};
return Response.ok(sout).
type(MediaType.APPLICATION_XML).
build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Optional;

import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.collections4.IterableUtils;
import org.apache.commons.collections4.Predicate;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.staxutils.StaxUtils;
import org.apache.syncope.client.lib.AnonymousAuthenticationHandler;
Expand Down Expand Up @@ -135,13 +135,11 @@ public void createLoginRequest() {
public void setIdPMapping() {
Assume.assumeTrue(SAML2SPDetector.isSAML2SPAvailable());

SAML2IdPTO ssoCircle = IterableUtils.find(saml2IdPService.list(), new Predicate<SAML2IdPTO>() {
Optional<SAML2IdPTO> ssoCircleOpt =
saml2IdPService.list().stream().filter(o -> "https://idp.ssocircle.com".equals(o.getEntityID())).findFirst();
assertTrue(ssoCircleOpt.isPresent());

@Override
public boolean evaluate(final SAML2IdPTO object) {
return "https://idp.ssocircle.com".equals(object.getEntityID());
}
});
SAML2IdPTO ssoCircle = ssoCircleOpt.get();
assertNotNull(ssoCircle);
assertFalse(ssoCircle.getMappingItems().isEmpty());
assertNotNull(ssoCircle.getConnObjectKeyItem());
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ under the License.
<dependency>
<groupId>org.apache.wss4j</groupId>
<artifactId>wss4j-ws-security-dom</artifactId>
<version>2.1.10</version>
<version>2.2.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.jasypt</groupId>
Expand Down

0 comments on commit 2f18275

Please sign in to comment.