How to use authentication in client requests
- Last Updated: November 1, 2019
- 1 minute read
- Corticon
- Documentation
When a request is submitted by a client to a Decision Service on a secured Corticon Server, the client must have credentials to enable connection to the server. The credentials must permit Execution operations.
You embed the username/password in the HTTP GET or an HTTP POST in the Authorization parameter in the header of the request,
as follows:
- Get the
HttpPostobject that is to connect to the URL on the Server:HttpPost postRequest = new HttpPost("http://localhost:8850/corticon/execute"); - Create an
encodedStringand add it to the specific Header:// Encode the username/password in Base64. This is needed for REST calls String username = "admin"; String password = "admin"; encodedString = Base64.encode((username + ":" + password).getBytes()); String base64EncodedCredentials = "Basic " + encodedString; // Add the String to the appropriate Header postRequest.setHeader("Authorization", base64EncodedCredentials);