Overview
Version
FineBI Version | Functional Change |
---|---|
6.0 | / |
Application Scenarios
You may want to customize authentication rather than use the built-in authentication of the platform. For example, you want to customize authentication when integrating a template into your system.
Functions
If HTTP authentication is enabled, the platform will encrypt the entered username and password and transmit them to the HTTP authentication server. The HTTP authentication server will return the authentication result to the platform after performing the custom authentication logic.

Authentication Through Node
Downloading the Authentication File
1. Click to download: http-authentication.zip
2. Unzip the downloaded package into a local directory such as E:\HTTP.
In the file auth.js under the directory http-authentication\node, you can see the HTTP authentication.
The authentication logic of this section: Only if the username and password are consistent with those of the HTTP authentication server, can you log into the platform.
You can modify if (content.username === content.password) in the file auth.js to change the authentication logic as needed.
Starting the Server
Open the command prompt and enter the following commands to start the server:
1. Install npm first. The installation process is omitted.
2. Go to the directory http-authentication\node.

e:
cd E:\HTTP\http-authentication\node
3. Install dependencies.
npm install
4. Generate public key and private key. The generated keys will be in the file key.txt.
npm run key
5. Start the server. The first two commands are only required during initialization for the first time. Next time when you start the server, you can start with npm start.
npm start
The authentication address is http://0.0.0.0:3000/.
Getting Public Key
After starting the server, open the file key.txt in the folder Node, and copy the public key.
Enabling HTTP Authentication on Decision-making Platform
Log into the decision-making platform as admin, choose System Management > User Management, click to go to Global Setting, enable HTTP Authentication, enter authentication address and public key, and click Save.

Demonstration
Click Save, and the prompt will pop up: Login information has expired, so please log in again.
Enter the username restored in User Management on the login interface. If the password and username are consistent with those of HTTP authentication server, you can log in successfully. Otherwise, you cannot log in.
Authentication Through Java
The two authentication methods in this section: Only if the username and password are consistent, can the user log into the decision-making platform.
Method One: Execute Through Source Code Project
Downloading the Authentication File
Download and unzip the package: http-authentication-java.zip
Executing the Project
Open the file pom.xml with IDEA or Eclipse and execute WebServerMain.
Copying Public Key
After starting the sever, open the file key.txt in the folder target of the compiling directory, copy public key to the platform, and the server address is http://0.0.0.0:9090/.

Demonstration
Click Save, and the prompt will pop up: Login information has expired, so please log in again.
Enter the username restored in User Management on the login interface. If the username and password are consistent, you can log in successfully. Otherwise, you cannot log in.
Method Two: Execute Through Command Lines
Downloading the File
1. Click to download the JAR package: http-authentication-java.jar
2. Unzip the downloaded JAR package to a folder with WinRAR.

Executing the File
Go to the location of the unzipped files by entering the command lines. Enter java WebServerMain to start the server.

Copying Public Key
1. After starting the server, open the file key.txt, and copy public key.
2. Paste the copied public key to the platform, and the server address is http://0.0.0.0:9090/.
Demonstration
Click Save, and the prompt will pop up: Login information has expired, so please log in again.
Enter the username restored in User Management on the login interface. If the username and password are consistent, you can log in successfully. Otherwise, you cannot log in.