-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LMSA-9652 - added event authorization event publisher and removed the… #30
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
38eb240
LMSA-9652 - added event authorization event publisher and removed the…
iudsobiera b8d0005
LMSA-9652 - removed uneeded filter
iudsobiera aca615b
LMSA-9652 - perhaps use this profile?
iudsobiera 288d183
LMSA-9652 - add license
iudsobiera c3e34bc
LMSA-9652 - removed publisher (moved to common-configuration in embed…
iudsobiera 9007458
LMSA-9652 - updated dep versions
iudsobiera File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
29 changes: 29 additions & 0 deletions
29
src/main/java/edu/iu/uits/lms/canvasnotifier/config/LmsAuthorizationEventPublisher.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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package edu.iu.uits.lms.canvasnotifier.config; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.context.ApplicationEventPublisher; | ||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.security.authorization.AuthorizationDecision; | ||
import org.springframework.security.authorization.AuthorizationEventPublisher; | ||
import org.springframework.security.authorization.event.AuthorizationEvent; | ||
import org.springframework.security.core.Authentication; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.function.Supplier; | ||
|
||
@Profile("it12") | ||
@Component | ||
@Slf4j | ||
public class LmsAuthorizationEventPublisher implements AuthorizationEventPublisher { | ||
private ApplicationEventPublisher applicationEventPublisher; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we put this publisher in a common place (vs in the tool here) like the old stuff was? And by publisher I mean this whole class/file. The issue doing that is that anything using that common place will be publishing authorization events. And, perhaps, that's okay? |
||
|
||
public LmsAuthorizationEventPublisher(ApplicationEventPublisher applicationEventPublisher) { | ||
this.applicationEventPublisher = applicationEventPublisher; | ||
} | ||
|
||
@Override | ||
public <T> void publishAuthorizationEvent(Supplier<Authentication> authentication, | ||
T object, AuthorizationDecision decision) { | ||
applicationEventPublisher.publishEvent(new AuthorizationEvent(authentication, object, decision)); | ||
} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we want to use this profile to turn authorization event publishing on? If so, we'd have to change the runtime profiles for our apps that use this (to help community runs by leaving this off). Otherwise, we'd remove this profile and always have authorization event publishing on