-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged in feature/shibui-1774 (pull request #497)
Feature/shibui 1774 Approved-by: Jonathan Johnson Approved-by: Bill Smith
- Loading branch information
Showing
19 changed files
with
440 additions
and
311 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 11 additions & 9 deletions
20
...c4j/SAML2ModelAuthorizationGenerator.java → ...calUserProfileAuthorizationGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
package net.unicon.shibui.pac4j; | ||
|
||
import edu.internet2.tier.shibboleth.admin.ui.security.model.User; | ||
import edu.internet2.tier.shibboleth.admin.ui.security.repository.UserRepository; | ||
import java.util.Optional; | ||
|
||
import org.pac4j.core.authorization.generator.AuthorizationGenerator; | ||
import org.pac4j.core.context.WebContext; | ||
import org.pac4j.saml.profile.SAML2Profile; | ||
import org.pac4j.core.context.session.SessionStore; | ||
import org.pac4j.core.profile.UserProfile; | ||
|
||
import java.util.Optional; | ||
import edu.internet2.tier.shibboleth.admin.ui.security.model.User; | ||
import edu.internet2.tier.shibboleth.admin.ui.security.repository.UserRepository; | ||
|
||
public class SAML2ModelAuthorizationGenerator implements AuthorizationGenerator<SAML2Profile> { | ||
public class LocalUserProfileAuthorizationGenerator implements AuthorizationGenerator { | ||
private final UserRepository userRepository; | ||
|
||
public SAML2ModelAuthorizationGenerator(UserRepository userRepository) { | ||
public LocalUserProfileAuthorizationGenerator(UserRepository userRepository) { | ||
this.userRepository = userRepository; | ||
} | ||
|
||
@Override | ||
public SAML2Profile generate(WebContext context, SAML2Profile profile) { | ||
public Optional<UserProfile> generate(WebContext context, SessionStore sessionStore, UserProfile profile) { | ||
Optional<User> user = userRepository.findByUsername(profile.getUsername()); | ||
user.ifPresent( u -> profile.addRole(u.getRole())); | ||
return profile; | ||
user.ifPresent( u -> profile.addRole(u.getRole()) ); | ||
return Optional.of(profile); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
pac4j-module/src/main/java/net/unicon/shibui/pac4j/Pac4jAuditorAware.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.