Login Authentication
Function
Implement basic authentication for login and return the HTTP client after login.
Prerequisites
User cluster information and login account have been configured.
- Configuration file: Sample project folder\conf\UserInfo.properties
- Parameters:
- userName: username for logging in to FusionInsight Manager.
- password: password of the username.
- webUrl: address of the Manager home page.
In the following example, IP_Address indicates the floating IP address of the cluster.
If you want to use another user to perform operations, you need log in to FusionInsight Manager to create a user.
userName= admin password= adminPassWord webUrl= https://IP_Address:28443/web/
Example code
The following provides an example code of invoking the firstAccess interface to perform login authentication, which is included in the main method of the rest.UserManager class.
BasicAuthAccess authAccess = new BasicAuthAccess(); HttpClient httpClient = authAccess.loginAndAccess(webUrl, userName, password, userTLSVersion); LOG.info("Start to access REST API."); HttpManager httpManager = new HttpManager(); String operationName = ""; String operationUrl = ""; String jsonFilePath = "";
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot