openxava
Blog

September 27, 2022

XavaPro 7.0 released

XavaPro 7.0 has the next new features:

  • Maven support.
  • Custom code to refine or override default authentication logic. 
  • Works with OpenXava 7.0.
Learn more about XavaPro

Maven support

We have made a great effort to refactor XavaPro to be Maven compatible. As a result now it’s easier to upgrade from OpenXava to XavaPro, and to upgrade to a newer version of XavaPro.
To upgrade to XavaPro 7 from XavaPro 6.x, follow the next steps:

  1. Install XavaPro in your local Maven repository. If you’re an Enterprise customer you will receive the XavaPro 7 distribution with instructions to install it in your repository.
  2. Use OpenXava Studio 7 to create a new project.
  3. Edit the pom.xml of your new project and change the dependency from openxava to xavapro. More about this below.
  4. Copy the code from your current project to the new one, following the migration instructions for OpenXava 7.0.

For the point 3, edit the pom.xml and look for these lines:

<dependency>
    <groupId>org.openxava</groupId>
    <artifactId>openxava</artifactId>
    <version>${openxava.version}</version>
</dependency>

And change them for these lines:

<dependency>
    <groupId>com.openxava</groupId>
    <artifactId>xavapro</artifactId>
    <version>${openxava.version}</version>
</dependency>

Then do a mvn clean install on your project.

Custom authentication code

In XavaPro 7.0 you can define your own logic for user authentication. For that you have to create a class that implements the ISignInHelperProvider interface. The typical case is to refine the standard way XavaPro authenticates users, for that extend ProSignInHelperProvider, in this way:

package com.mycompany.myapp.impl;

import javax.servlet.*;
import org.openxava.util.*;
import com.openxava.naviox.impl.*;

public class MyCustomSignInHelperProvider extends ProSignInHelperProvider {
	
    @Override
    public boolean isAuthorized(
        ServletRequest request, String userName, 
        String password, Messages errors, String unauthorizedMessage) 
    {
        // This is your custom authentication logic
        if (userName.equals("admin") && password.equals("masterkey")) {
            return true; 
        }
		
        // In the next line we rely in the default XavaPro authentication logic
        return super.isAuthorized(
            request, userName, password, errors, unauthorizedMessage);
    }

}

In this case the logic is simple, if the user type "masterkey" as password for "admin" user it access to the application as "admin", otherwise the regular authentication logic of XavaPro is applied. However, here you can write any logic you want, including calling web services, reading your own users database, consulting your LDAP directory in the way you want, etc.

In order your application uses the above class for authentication you have to add the next entry in the naviox.properties file of your project:

signInHelperProviderClass=com.mycompany.myapp.impl.MyCustomSignInHelperProvider

Try it yourself

Demo: https://www.openxava.org/xavaprotest (User: demo, Password: demo)

If you want to try the admin features reply to this email asking for the admin password.
If you want to try the mobile features access to above URL using your mobile phone.

To learn more go to the XavaPro page.

If you're an Enterprise customer you will receive an email with the upgraded Enterprise edition.

blog comments powered by Disqus

Español