Presto Development and APIs : Working with the Presto REST API : Login or Set Guess Access
Login or Set Guess Access
Authentication requirements depends on how authentication is configured in Presto:
*With Single Sign-On: authentication is handled automatically by the SSO solution. Login is not required and no additional information is needed in requests.
*With Digital Certificates and SSL: authentication is handled automatically with SSL. Login is not required and no additional information is needed in requests.
*Anonymous Requests for Guest Access: supply no user credentials, so that Presto treats request as coming from a guest user. To send anonymous requests, include the x-p-anonymous Presto header/parameter in the URL of each request or as an HTTP header.
*With Basic Credentials: this is the default authentication mechanism when you install Presto. In this case, you must use the REST API method to login to create a Presto session and authenticate the user. You can also use the REST API method to logout.
*For Login use this URL:
http://app-server:port/presto/edge/api/rest/UserManagerService/login?presto_username=username&presto_password=pw
Both parameters must be in clear text.
*For Logout use this URL:
http://app-server:port/presto/edge/api/rest/UserManagerService/logout
Using jQuery, for example, you would login something like this:
jQuery(function() {
var requestBody = '';

jQuery.ajax({
type: "get",
contentType: "application/x-www-form-urlencoded",
url: "/presto/edge/api/rest/UserManagerService/login?x-presto-resultFormat=json&presto_username=
userA&presto_password=pwA",
data: requestBody,
dataType: "text",
success: function(response){
var result = response;
if(typeof response !== "string") {
result = Object.toJSON(response);
}
//handle success
},
error: function(xhr, errorStatus, e) {
//handle error
}
});
});
Copyright © 2013-2015 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback