Skip to content

Commit

Permalink
Upgraded to latest 3rd party libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Dec 14, 2018
1 parent 554fd0e commit 2c346b3
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 19 deletions.
2 changes: 1 addition & 1 deletion mujina-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>org.openconext</groupId>
<artifactId>mujina</artifactId>
<version>7.0.7</version>
<version>7.1.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion mujina-idp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>org.openconext</groupId>
<artifactId>mujina</artifactId>
<version>7.0.7</version>
<version>7.1.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 2 additions & 0 deletions mujina-idp/src/main/java/mujina/api/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;
Expand All @@ -12,6 +13,7 @@
@Getter
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class User implements Serializable {

private String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ private SAMLMessageDecoder samlMessageDecoder(boolean postRequest) {
SAMLConstants.SAML2_POST_BINDING_URI)));
}

@SuppressWarnings("unchecked")
public void sendAuthnResponse(SAMLPrincipal principal, HttpServletResponse response) throws MarshallingException, SignatureException, MessageEncodingException {
Status status = buildStatus(StatusCode.SUCCESS_URI);

Expand Down
9 changes: 5 additions & 4 deletions mujina-idp/src/main/java/mujina/idp/SsoController.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public void singleSignOnServicePost(HttpServletRequest request, HttpServletRespo
doSSO(request, response, authentication, true);
}

@SuppressWarnings("unchecked")
private void doSSO(HttpServletRequest request, HttpServletResponse response, Authentication authentication, boolean postRequest) throws ValidationException, SecurityException, MessageDecodingException, MarshallingException, SignatureException, MessageEncodingException, MetadataProviderException, IOException, ServletException {
SAMLMessageContext messageContext = samlMessageHandler.extractSAMLMessageContext(request, response, postRequest);
AuthnRequest authnRequest = (AuthnRequest) messageContext.getInboundSAMLMessage();
Expand All @@ -77,16 +78,16 @@ private void doSSO(HttpServletRequest request, HttpServletResponse response, Aut
samlMessageHandler.sendAuthnResponse(principal, response);
}

@SuppressWarnings("unchecked")
private List<SAMLAttribute> attributes(Authentication authentication) {
String uid = authentication.getName();
final Map<String, List<String>> result = new HashMap<>();
result.putAll(idpConfiguration.getAttributes());
Map<String, List<String>> result = new HashMap<>(idpConfiguration.getAttributes());


Optional<Map<String, List<String>>> optionalMap = idpConfiguration.getUsers().stream().filter(user -> user
.getPrincipal()
.equals(uid)).findAny().map(user -> user.getAttributes());
optionalMap.ifPresent(map -> result.putAll(map));
.equals(uid)).findAny().map(FederatedUserAuthenticationToken::getAttributes);
optionalMap.ifPresent(result::putAll);

//See SAMLAttributeAuthenticationFilter#setDetails
Map<String, String[]> parameterMap = (Map<String, String[]>) authentication.getDetails();
Expand Down
1 change: 1 addition & 0 deletions mujina-idp/src/main/java/mujina/idp/UserController.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class UserController {
private List<Map<String, String>> samlAttributes;

@Autowired
@SuppressWarnings("unchecked")
public UserController(ObjectMapper objectMapper) throws IOException {
this.samlAttributes = objectMapper.readValue(new ClassPathResource("saml-attributes.json").getInputStream(), List.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.core.env.Environment;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
Expand Down Expand Up @@ -151,10 +152,14 @@ protected void configure(HttpSecurity http) throws Exception {
}

@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
public void configure(AuthenticationManagerBuilder auth) {
auth.authenticationProvider(new AuthenticationProvider(idpConfiguration));
}

@Bean
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
}

}
2 changes: 1 addition & 1 deletion mujina-sp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>org.openconext</groupId>
<artifactId>mujina</artifactId>
<version>7.0.7</version>
<version>7.1.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
1 change: 1 addition & 0 deletions mujina-sp/src/main/java/mujina/sp/SAMLConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public WebSSOProfileConsumer webSSOprofileConsumer() {
WebSSOProfileConsumerImpl webSSOProfileConsumer = environment.acceptsProfiles("test") ?
new WebSSOProfileConsumerImpl() {
@Override
@SuppressWarnings("unchecked")
protected void verifyAssertion(Assertion assertion, AuthnRequest request, SAMLMessageContext context) throws AuthenticationException, SAMLException, org.opensaml.xml.security.SecurityException, ValidationException, DecryptionException {
//nope
context.setSubjectNameIdentifier(assertion.getSubject().getNameID());
Expand Down
33 changes: 22 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,20 @@

<groupId>org.openconext</groupId>
<artifactId>mujina</artifactId>
<version>7.0.7</version>
<version>7.1.0</version>
<packaging>pom</packaging>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<spring-boot.version>1.5.2.RELEASE</spring-boot.version>
<spring-security-oauth2.version>2.1.0.RELEASE</spring-security-oauth2.version>
<httpclient.version>4.5.3</httpclient.version>
<spring-security-saml2-core.version>1.0.2.RELEASE</spring-security-saml2-core.version>
<httpclient.version>4.5.6</httpclient.version>
<spring-security-saml2-core.version>1.0.4.RELEASE</spring-security-saml2-core.version>
</properties>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
<version>1.5.18.RELEASE</version>
<relativePath/>
</parent>

Expand All @@ -53,6 +51,19 @@
<tag>HEAD</tag>
</scm>

<repositories>
<repository>
<id>mulesoft</id>
<name>mulesoft</name>
<url>https://repository.mulesoft.org/releases/</url>
</repository>
<repository>
<id>shibboleth</id>
<name>shibboleth</name>
<url>https://build.shibboleth.net/nexus/content/repositories/releases/</url>
</repository>
</repositories>

<build>
<plugins>
<plugin>
Expand All @@ -62,7 +73,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4</version>
<version>1.4.1</version>
<executions>
<execution>
<id>enforce-versions</id>
Expand All @@ -85,12 +96,12 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.1</version>
<version>2.7</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.5.201505241946</version>
<version>0.8.2</version>
<executions>
<execution>
<goals>
Expand All @@ -109,7 +120,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.2</version>
<version>2.5.3</version>
<configuration>
<tagNameFormat>v@{project.version}</tagNameFormat>
<autoVersionSubmodules>true</autoVersionSubmodules>
Expand All @@ -120,7 +131,7 @@
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav-jackrabbit</artifactId>
<version>3.0.0</version>
<version>3.2.0</version>
</extension>
</extensions>
</build>
Expand Down

0 comments on commit 2c346b3

Please sign in to comment.