Skip to main content



      Home
Home » Eclipse Projects » Eclipse Scout » Form-based authentication on production environment(Form-based authentication is not used/applied on production environment.)
Form-based authentication on production environment [message #1865988] Thu, 16 May 2024 22:53 Go to next message
Eclipse UserFriend
Good day all!

I have a problem on form-based authentication. On development environment the form-based authentication is working fine. It works according to its expected operation. Now, when i build the project for production and deployed it, the form-based authentication does not work. It seems it used the other method of authentication. Based on the logs, the UI is able to capture the username & password but when the UI make a POST request to the server for authentication it seems the server did not get it correctly. On the old version, it works fine but using the latest version it wont work. I think there are things need to configure properly when using HTTP but i am not sure which part. Could someone give me a hint or direct me to which files, settings, or configuration to look for.

These are the details:


  • Eclipse Scout version 24.1
  • Java 17
  • Operating System: Devuan (daedalus) 64-bit
  • Using HTTP
  • UI-> config.properties: scout.app.sessionCookieConfigSecure=false
  • UI->config.properties: scout.backendUrl=http://localhost:8080
  • ui & server are on same machine.


Thanks in advance, guys..

Sincerely,

Novem

Re: Form-based authentication on production environment [message #1865994 is a reply to message #1865988] Fri, 17 May 2024 02:42 Go to previous messageGo to next message
Eclipse UserFriend
Hi Novem

What do you mean by "the server did not get it correctly"? What's the behavior? Does the login form show again without any validation error?

When you're using HTTP instead of HTTPS in a deployed environment (which is not recommended), you need to set the property 'scout.app.sessionCookieConfigSecure' to false, otherwise the session cookie uses the secure flag and isn't processed by the browser. But that is what you already did.

UiServletFilter will process the request in the UI server, using the FormBasedAccessController. Do you use credentials defined in the config.properties? If so, make sure to set them in the config.properties of the .app.zip or .app.image module correctly.

Regards
Stephan

[Updated on: Fri, 17 May 2024 03:05] by Moderator

Re: Form-based authentication on production environment [message #1866000 is a reply to message #1865994] Fri, 17 May 2024 04:14 Go to previous messageGo to next message
Eclipse UserFriend
Hello Stephan,

Thanks for the reply. Actually I am using a reverse proxy (nginx) server where the website security (certificate) implemented that's why i just use the HTTP. On the previous version of the scout with the same settings, everything works perfectly. In this current version (24.1), yes it does show the login box the UI server even logs the current username and password. In my authentication on the client side, i have this:

ScoutServiceCredentialVerifier.java
 final IFuture<UserFormData> passwordCaller = Jobs.schedule(new Callable<UserFormData>() {
				@Override
		//		@SuppressWarnings("PMD.SignatureDeclareThrowsException")
				public UserFormData call() throws Exception {
					final IUserService userService = BEANS.get(IUserService.class);
					final UserFormData userFormDataInput = new UserFormData();
					userFormDataInput.getLogin().setValue(username);
					userFormDataInput.getEmail().setValue(username);
					final UserFormData userPassFormData = userService.getAuthenticate(userFormDataInput, passwordPlainText);
					return userPassFormData;
				}
			}, Jobs.newInput()
					.withRunContext(ClientRunContexts.copyCurrent(true).withSubject(this.retrievePasswordCheckerSubject())
							.withUserAgent(UserAgents.createDefault()).withSession(null, false))
					.withName(this.buildJobName()));

			savedPassword = passwordCaller.awaitDoneAndGet(30, TimeUnit.SECONDS);
    ..
   ..
    LOG.warn("Bad username or password for username : " + username +" -> Thru API Authentication");
  ..
  ..



On server side, i have this:
UserService.java
@Override
	public UserFormData getAuthenticate(final UserFormData userPassFormData, char[] passwordPlainText) {
		String password = "";
		int len = passwordPlainText.length;
		for(int i = 0; i < len; i++) {
			password = password + passwordPlainText[i];
		}

		//Authenticate user using LDAP through API
		Object[] userIdAndToken = apiAuthentication(userPassFormData.getLogin().getValue(), password);
  ..
 ...
  ..


The problem is, this userService.getAuthenticate(userFormDataInput, passwordPlainText) is not executed and that the getAuthenticate(...) is not invoked!
It seems the UI is calling its default account verifier. But in my UiServletFilter.java i have this:
..
..
 m_formBasedAccessController = BEANS.get(FormBasedAccessController.class).init(new FormBasedAuthConfig().withCredentialVerifier(BEANS.get(ScoutServiceCredentialVerifier.class)));
..
..


If ScoutServiceCredentialVerifier.class is not used, then by print a logs,
Bad username or password for username : marknovemg -> Thru API Authentication

I am in the process of tracing and debugging the problem, and revisited the latest documentation of scout.

That's the other details Stephan, thanks again.

Sincerely,

Mark Novem










Re: Form-based authentication on production environment [message #1866003 is a reply to message #1866000] Fri, 17 May 2024 04:48 Go to previous messageGo to next message
Eclipse UserFriend
Not related to your issue, but just as additional information: if you're accessing your application from the browser via HTTPS (via reverse proxy), you don't need to set scout.app.sessionCookieConfigSecure to false.

I'd recommend to either do remote debugging or add additional LOG entries at various positions in order to detect which code is reached and which code isn't.

The code in UiServletFilter seems to be correct and you own verifier should be used. Do you have the RemoteServiceWithoutAuthorization annotation on the method IUserService#getAuthenticate? You're calling this method without a proper authentication, that's why the backend server would deny that access (including a corresponding log output I think). That behavior shouldn't have changed between 23.2 and 24.1 though.
Re: Form-based authentication on production environment [message #1866063 is a reply to message #1866003] Tue, 21 May 2024 03:39 Go to previous messageGo to next message
Eclipse UserFriend
After days of debugging and thorough analysis of every logs and considering all aspects from project build, firewall, to reverse proxy logs. I just nailed it and successfully deployed it on production environment.

1. As to my assumption that the server received a wrong parameter -> i was wrong, the server received the correct parameter. It just seems wrong based on the logs but the server does perform only the other option when the first option is not available.
2. As to my assumption that method userService.getAuthenticate(...); was not invoked, again i was wrong. It was invoked and actually it is where the actual problem occurs.
3. As to my assumption that there might configurations needs to done when using HTTP, i just follow the eclipse scout documents with the consideration of Stephan's comments on 'scout.app.sessionCookieConfigSecure'.

Actions performed:
1. perform project build, considering all settings. Results: Same problem
2. putting LOG.info(...) on every entry points. Results: Specific entry points where the error occurs identified. But the log information does not provide a direct or specific cause or error.
3. Since we're suing API base authentication and the API URL is part of being printed of the logs, I copied the URL and perform "wget API-URL" directly on the terminal of server. Result: Specific error identified -> "connection refused"
4. Login to the reverse proxy server to confirm the error logs. Results: confirmed! "...connection refused.."
5. Copy the API-URL and test it on my machine. Results: Connection success!
6. Checking the firewall for possible rules that might block the server IP. Result! No logs that show the server IP is blocked.
7. Since we're using DJango API as our API framework, checking the API logs. Result. Connection refused! confirmed! It is the API that cause the error. The client IP is not allowed to access the API.

Cause of the problem:

1. The API does not allowed the client IP to access the API server.

Solution: Add the client IP to the allowed hosts settings of API settings.

Results: Successfully deployed Eclipse Scout on production environment (Devuan server) using a form-based authentication with API (Django API) as a base authentication point and LDAP (OpenLDAP) as the authentication source of API.

For those who might have encounter a problem identical to mine, hope this information can help you.

Thank you Stephan for the assistance.

Sincerely,

Mark Novem Pero Grisola



















Re: Form-based authentication on production environment [message #1866066 is a reply to message #1866063] Tue, 21 May 2024 03:57 Go to previous message
Eclipse UserFriend
Thanks for your detailed response, I'm glad it works now.
Previous Topic:Simple tab area moves down opening a view in BenchLayoutData
Next Topic:[Solved] Project build failure due to Node.js v20.13.1. Missing yargs-parser?
Goto Forum:
  


Current Time: Tue Jun 24 16:34:47 EDT 2025

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

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

Back to the top