Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » How to configure LdapLoginModule for use with Jetty(Trying to use form based authentication)
How to configure LdapLoginModule for use with Jetty [message #1745026] Tue, 04 October 2016 10:02
Urs Beeli is currently offline Urs BeeliFriend
Messages: 565
Registered: October 2012
Location: Bern, Switzerland
Senior Member
We are working on a prototype migration of our Scout Mars application. We have succesfully ported it to Neon but there are still some open points.

We require form-based authentication against an LDAP server. As we did not find out quickly how to do this using Jetty, we abandoned the "app.dev" projects and added the maven-tomcat7-plugin to our war projects. This is something we were already doing in our Mars setup and the corresponding tomcat filter works nicely with out LDAP.

In order to make Form based authentication work with tomcat's LDAP filter we made some adjustments to web.xml
   ...
    <login-config>
        <auth-method>FORM</auth-method>
        <form-login-config>
            <form-login-page>/login.html</form-login-page>
            <form-error-page>/login.html</form-error-page>
        </form-login-config>
    </login-config>
    <security-role>
        <role-name>*</role-name>
    </security-role>
   ...


We have also adjusted the LoginBox.js to match this:
...
  this.$form = $('<form>')
    .attr('action', 'j_security_check')
    .attr('method', 'post')
    .submit(this._onLoginFormSubmit.bind(this))
    .appendTo(this.$content);
...
scout.LoginBox.prototype._onLoginFormSubmit = function(event) {
  // Prevent default submit action
  event.preventDefault();

  var url = this.$form.attr('action');
  var data = {
	        j_username: this.$user.val(),
	        j_password: this.$password.val()
  };
...


HOWEVER
Using the tomcat-plugin setup, we constantly need to stop the UI server, do a local maven build, then restart the UI server to see any changes we make in the GUI code. This is far form efficient and so I am spending some time to look into making our application work with the two jetty projects again. I've re-introduced the server.app.dev and ui.html.app.dev projects back into my workspace (copying them from a freshly generated helloworld example). I've got the server.app.dev Jetty running without errors. Trying to get the ui.html.app.dev instance up and running fails however.

I get the following error message when launching jetty:
2016-10-04 09:56:27,953 WARN  main org.eclipse.jetty.util.component.AbstractLifeCycle - FAILED org.eclipse.jetty.server.Server@1f57539: java.lang.IllegalStateException: No LoginService for org.eclipse.jetty.security.authentication.FormAuthenticator@87f383f in org.eclipse.jetty.security.ConstraintSecurityHandler@4eb7f003 [ @   ]
java.lang.IllegalStateException: No LoginService for org.eclipse.jetty.security.authentication.FormAuthenticator@87f383f in org.eclipse.jetty.security.ConstraintSecurityHandler@4eb7f003
	at org.eclipse.jetty.security.authentication.LoginAuthenticator.setConfiguration(LoginAuthenticator.java:76) ~[jetty-security-9.2.13.v20150730.jar:9.2.13.v20150730]
	at org.eclipse.jetty.security.authentication.FormAuthenticator.setConfiguration(FormAuthenticator.java:133) ~[jetty-security-9.2.13.v20150730.jar:9.2.13.v20150730]


I guess this is due to defining Form-based authentication in the web.xml.

Googling a bit I found the following pages
* https://www.eclipse.org/jetty/documentation/9.3.x/configuring-security-authentication.html
* https://wiki.eclipse.org/Jetty/Tutorial/JAAS#LdapLoginModule
which seem to indicate that what we are doing using Tomcat should also be possible with Jetty

However, all the examples are working with XML based configuration of Jetty and I have not found out how I can pass these configuration files to the Jetty instance started with the following dependency:
<dependency>
<groupId>org.eclipse.scout.rt</groupId>
<artifactId>org.eclipse.scout.dev.jetty</artifactId>
</dependency>

Is there some documentation on how to do this?
Previous Topic:Default login form after deploy to Tomcat 9
Next Topic:Outline with navigation tree with unknown depth
Goto Forum:
  


Current Time: Mon Jul 24 03:11:17 GMT 2017

Powered by FUDForum. Page generated in 0.02553 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software