Code changed in jenkins User: Dominic Scheirlinck Path: src/main/java/org/jenkinsci/plugins/GithubSecurityRealm.java http://jenkins-ci.org/commit/github-oauth-plugin/d6bc0211b9627ecdc6687e34d97483146d06eff5 Log: JENKINS-34775 Don't cast inconvertible un/pw token
Fixes JENKINS-34775.
The loadUserByUsername method expects to be able to get the current user's token with `SecurityContextHolder.getContext().getAuthentication()`, and assumes this method will return a GithubAuthenticationToken. When it returns a UserPasswordAuthenticationToken instead, a fatal cast was performed.
We now handle the case where the current authentication context contains a UserPasswordAuthenticationToken (by throwing an exception - so, not successfully handled, but this prevents the loadUserByUsername failure bubbling up to become a job failure).
|