Skip to content

Commit

Permalink
[SHIBUI-1058]
Browse files Browse the repository at this point in the history
More security WIP goodness.
  • Loading branch information
Bill Smith committed Jan 28, 2019
1 parent 2e79fb5 commit ebb0605
Show file tree
Hide file tree
Showing 5 changed files with 3,754 additions and 167 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Optional;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ public Config config(final Pac4jConfigurationProperties pac4jConfigurationProper
saml2ClientConfiguration.setServiceProviderMetadataPath(pac4jConfigurationProperties.getServiceProviderMetadataPath());
saml2ClientConfiguration.setForceServiceProviderMetadataGeneration(pac4jConfigurationProperties.isForceServiceProviderMetadataGeneration());
saml2ClientConfiguration.setWantsAssertionsSigned(pac4jConfigurationProperties.isWantAssertionsSigned());
// TODO: make not hardcoded
saml2ClientConfiguration.setAttributeAsId("email");
Map<String, String> mappedAttributes = new HashMap<>();
// TODO: make not hardcoded
mappedAttributes.put("email", Pac4jConstants.USERNAME);
saml2ClientConfiguration.setMappedAttributes(mappedAttributes);

/* Map<String, String> mappedAttributes = new HashMap<>();
mappedAttributes.put(pac4jConfigurationProperties.getSaml2ProfileMapping().getUsername(), Pac4jConstants.USERNAME);
saml2ClientConfiguration.setMappedAttributes(mappedAttributes);*/

saml2ClientConfiguration.setAttributeAsId(pac4jConfigurationProperties.getSaml2ProfileMapping().getUsername());

final SAML2Client saml2Client = new SAML2Client(saml2ClientConfiguration);
saml2Client.setName("Saml2Client");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public SAML2ModelAuthorizationGenerator(UserRepository userRepository) {

@Override
public SAML2Profile generate(WebContext context, SAML2Profile profile) {
Optional<User> user = userRepository.findByUsername(profile.getUsername());
Optional<User> user = userRepository.findByUsername(profile.getId());
user.ifPresent( u -> profile.addRole(u.getRole()));
return profile;
}
Expand Down
141 changes: 0 additions & 141 deletions pac4j-module/src/main/java/org/pac4j/core/profile/CommonProfile.java

This file was deleted.

Loading

0 comments on commit ebb0605

Please sign in to comment.