History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: JRUBY-2416
Type: Bug Bug
Status: Closed Closed
Resolution: Not A Bug
Priority: Major Major
Assignee: Charles Oliver Nutter
Reporter: Eric Gascoine
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
JRuby

Need to access J2EE security info in Rails App

Created: 19/Apr/08 01:46 PM   Updated: 10/Sep/08 06:45 PM
Component/s: Java Integration, JRuby-extras, Rails WAR Deployment
Affects Version/s: JRuby 1.1
Fix Version/s: None

Time Tracking:
Not Specified

Environment:
running on:
   Tomcat 6.0.16 (tried 5.5 as well)
      Java 1.6.0_05 (64bit) on Linux (Sun implementation)
      Java 1.6.0_04 (32bit) on Windows (Sub implementation)


 Description  « Hide
App needs to take advantage of the Web security components in the Servlet container (facilitates Single Sign on in a way JRuby can't in this environment).

Like to have access the the request.getUserPrincipal and request.isUserInRole(String) methods.

Ruby returns nil and false respectively regardless of the fact that the servlet container has authenticated user.

Web.xml fragment:

<security-constraint>
<display-name>The application</display-name>
<web-resource-collection>
<web-resource-name>The Application</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>view</role-name>
</auth-constraint>
</security-constraint>

<login-config>
<auth-method>CLIENT-CERT</auth-method>
</login-config>

<security-role>
<description>viewer</description>
<role-name>view</role-name>
</security-role>

Code Fragment in view
<%= h $java_servlet_request.userPrincipal.inspect %> <br/>
<%= h $java_servlet_request.remoteUser.inspect %> <br/>

Both return the string 'nil' of course



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Darcy Schultz - 24/May/08 11:31 AM
I work with Eric. Not sure why this wasn't working for him but I couldn't reproduce the problem. Please close this issue.

Eric Gascoine - 24/May/08 12:52 PM
Sorry; This should have been closed earlier... I've update the build and this started working correctly.. I haven't narrowed down what fixed it, and am not willing to spend more time working out how it fixed.

Eric Gascoine - 25/May/08 11:02 PM
This is specifically caused by a change in Warbler in the 0.9.9 release, where Rack was used instead of goldspike.

The request object must be used as request.env['java.servlet_request'] rather than $java_request_object

This will catch people as a project is dependant on which version of warbler is used to package the war, so can vary from developer to developer on a team.


Charles Oliver Nutter - 25/Aug/08 07:52 PM
This represents a behavioral chance in warbler, but a change made for good reasons (avoiding globals to allow multiple requests to be handled safely at the same time). Could one of you add a FAQ to the wiki about this? At any rate, marking as Not A Bug.