-
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.
Changes from feedback
- Loading branch information
Showing
9 changed files
with
55 additions
and
64 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
14 changes: 7 additions & 7 deletions
14
...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,26 +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.core.context.session.SessionStore; | ||
import org.pac4j.core.profile.UserProfile; | ||
import org.pac4j.saml.profile.SAML2Profile; | ||
|
||
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 { | ||
public class LocalUserProfileAuthorizationGenerator implements AuthorizationGenerator { | ||
private final UserRepository userRepository; | ||
|
||
public SAML2ModelAuthorizationGenerator(UserRepository userRepository) { | ||
public LocalUserProfileAuthorizationGenerator(UserRepository userRepository) { | ||
this.userRepository = userRepository; | ||
} | ||
|
||
@Override | ||
public Optional<UserProfile> generate(WebContext context, SessionStore sessionStore, UserProfile profile) { | ||
Optional<User> user = userRepository.findByUsername(profile.getUsername()); | ||
user.ifPresent( u -> ((SAML2Profile)profile).addRole(u.getRole())); | ||
user.ifPresent( u -> profile.addRole(u.getRole()) ); | ||
return Optional.of(profile); | ||
} | ||
} |
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
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