Please sign in to comment.
[JENKINS-27027] Notify the SecurityListener on authentication (#3074)
* [JENKINS-27026] Notify the SecurityListener in case of Token based authentication success - due the current version of the method, the UserDetails required for the event was not accessible. In order to stay with the same API in SecurityListener, two "protected" methods were created to split the job and let the UserDetails accessible * - add test to ensure the SecurityListener is called for REST Token but also for regular basic auth * - remove the comment about the split, will be put in GitHub comment instead * - add check for anonymous call instead of just putting a comment - remove the constructor in the dummy - add link to PR from Daniel to simplify a call * - separate the before/after to save one clear and be more explicit - put more meaning in the assertLastEventIs method by explicitly say we will remove the last event * - add comment about why we do not fire the "failedToAuthenticated" in the case of an invalid token (tips: it's because it could be a valid password) * - also add the authenticated trigger on legacy filter as pointed by Ivan * - add support of event on CLI remoting authentication - adjust tests by moving the helper class used to spy on events * - as mentioned Yvan, the code had some problems with null checking, so the approach is changed in order to encapsulate all that internal mechanism * - add javadoc - open the getUserDetailsForImpersonation from the User (will let the SSHD module to retrieve UserDetails from that) * - remove single quote in log messages * - basic corrections requested by Jesse * - just another typo * - adjust the javadoc for SecurityListener events * - add the link to Jenkins#Anonymous * - add link (not using see) * - update comment on the isAnonymous as we (me + Oleg) do not find a best place at the moment * - put the new method isAnonymous in ACL instead of Functions * - little typo - add requirement about the SecurityContext authentication
- Loading branch information...
Showing with 403 additions and 40 deletions.
- +3 −6 core/src/main/java/hudson/Functions.java
- +26 −2 core/src/main/java/hudson/cli/CLICommand.java
- +4 −1 core/src/main/java/hudson/cli/ClientAuthenticationCache.java
- +3 −0 core/src/main/java/hudson/cli/LoginCommand.java
- +9 −0 core/src/main/java/hudson/cli/LogoutCommand.java
- +54 −7 core/src/main/java/hudson/model/User.java
- +10 −0 core/src/main/java/hudson/security/ACL.java
- +9 −1 core/src/main/java/hudson/security/BasicAuthenticationFilter.java
- +11 −1 core/src/main/java/jenkins/security/BasicHeaderApiTokenAuthenticator.java
- +10 −7 core/src/main/java/jenkins/security/SecurityListener.java
- +107 −5 test/src/test/java/hudson/security/CliAuthenticationTest.java
- +42 −10 test/src/test/java/jenkins/security/BasicHeaderProcessorTest.java
- +115 −0 test/src/test/java/jenkins/security/SpySecurityListener.java
Oops, something went wrong.