Closed bananastalktome closed 11 years ago
Thanks for the report!
Looks like this is failing:
getEventPublisher().publish(new LoginEvent(this, username, request.getSession().getId(), remoteHost, remoteIP));
Can't fix right now, but should be able to take a look this evening.
If you want to follow the setup in the README, you might be able to work on a fix also.
Here is what Joe Clark (Atlassian Dev Relations) had done last year: https://bitbucket.org/jaysee00/example-confluence-sso-authenticator/src/381eb95ebc08/src/main/java/com/atlassian/confluence/seraph/example/ExampleSSOAuthenticator.java#cl-120
i.e.
putPrincipalInSessionContext(request, user);
getElevatedSecurityGuard().onSuccessfulLoginAttempt(request, username);
// Firing this event is necessary to ensure the user's personal information is intialised correctly.
getEventPublisher().publish(new LoginEvent(this, username, request.getSession().getId(), remoteHost, remoteIP));
LoginReason.OK.stampRequestResponse(request, response);
log.info(String.format("Login for user %s successful.", username));
return user;
One difference is that he is using getElevatedSecurityGuard() and we were using:
getLoginManager().onSuccessfulLoginAttempt(username, request);
But there are probably other differences, even though they weren't mentioned in what I had received here:
I've just ensured that the authenticator shows up in marketplace as incompatible with 5.x until we can get this worked out.
Note that I'll be relying on you to test any changes I make, because I don't have a shib test environment at home yet. Hope that is ok.
One other very important thing. The version of Confluence in the pom.xml right now is still 4.x. Will need to modify that. In the pom.xml make it look like this and just see whether it compiles at first (hopefully have IDea or something available that will inspect and help a bit at least determining if method sigs changed).
<modelVersion>4.0.0</modelVersion>
<groupId>shibauth</groupId>
<artifactId>remoteUserAuth</artifactId>
<version>2.2.0-SNAPSHOT</version>
<properties>
<confluence.version>5.0.2</confluence.version>
<!-- Look at pom.xml in confluence version in https://maven.atlassian.com/content/repositories/atlassian-public/com/atlassian/confluence/confluence-project/ -->
<crowd.version>2.6.0</crowd.version>
<crowd.embedded.version>1.6</crowd.embedded.version>
</properties>
Pull reqs welcome, of course.
I changed pom.xml
to reference Confluence version 5.0.1 and, from build errors, found that I had to also include an additional parameter expected by the 'LoginEvent' constructor which was added in Confluence 5. The additional parameter is string loginSource
, as per http://docs.atlassian.com/atlassian-confluence/5.0/com/atlassian/confluence/event/events/security/LoginEvent.html, which I set as LoginEvent.UNKNOWN
because a) it worked and b) I don't know what it's for.
Changing those two pieces alone provides successful shib login (YAY!), and I didn't have to muck with the getElevatedSecurityGuard()
vs getLoginManager()
piece to get it working.
That all said, I don't know how this will work between 4.x and 5.x users.
ps. And also, I'm happy to test builds.
That's great!
Reading that javadoc, UNKNOWN sounds to be the best choice, although imo it should be called OTHER (but I won't argue over it since it's already published :) ).
If it's incompatible with Confluence 4.1-4.x (and before) that's fine, it just need to be a v2.2.0-SNAPSHOT as mentioned above and then we can release as 2.2.0 which will be Confluence 5.x compatible (actually I have to specifically state the version range in marketplace that is compatible, but that's just informational in the case of the authenticator since it can't be installed from within the app). Probably won't use major version change (3.0.0) for the authenticator version until we support passing info via the environment vs. headers (requested feature from the Shibboleth folks for some time, but I've not had time to work on it mostly because it would require testing :) ).
Thanks for the offer to test! I'll take you up on it. Feel free to pull req and then link to this ticket. Thanks again!
Thanks for the help! Will close this on release, hopefully tonight, then I could use your help testing it tomorrow if ok.
(Release should be identical to what you have except for version.)
Released in 2.2.0. Thanks!
Please test and let me know if it works for you.
@garysweaver Tested and shib login work great in Confluence 5.0 with v2.2.0 of the authenticator. Thanks!
Cool. Thanks for your contribution!
Using version 2.1.16 with Confluence 4.3.5 works fine, however when I tried upgrading to 5.0 (and also to 5.0.1) and attempt to log in in through Shibboleth I get an 'Oops - an error has occurred' page, and am not logged in. I get the following in the Confluence logs: