Transferring Credentials |
Credentials for the database chosen can be provided in various ways.
Explicit Logon Credentials
The logon code and password can be provided as parameters named 'user' and 'password'.
Basic Authentication
When present, a header named "Authorization" or "HTTP_AUTHORIZATION" is used for Basic Authentication. Logon code and password are taken from the header value following W3C Standards for Basic Authentication.
The authentication realm with Basic Authentication matches the database name when present and "Invantive Data Access Point Default" otherwise.
When Basic Authentication and Explicit Logon Credentials are combined, the logon codes must match. Otherwise, an error is returned.
OAuth Code Grant Flow Preauthenticated
The value of the X-Refresh-Token header is used to authenticate on the OAuth Code Grant Flow as specified for the database chosen in the settings.xml. When not specified as a header, the values of a GET or POST parameter with that name will be used.
OAuth Code Grant Flow Interactive HTML
In general, it is not necessary to make changes to accomodate the Code Grant Flow with a normal HTML site based upon Data Access Point creating pages one-by-one. When necessary, please use the '/token' path with the code and returnUrl parameters to authenticate.
OAuth Code Grant Flow Interactive AJAX
The '/auth' path allows AJAX calls to redirect to a log on page, returning JSON which can be evaluated from code like:
{
//
// Get user information for picture and name in header.
//
var url = "auth?preset=nl-some-query" + "&returnUrl=" + encodeURIComponent(window.location.href);
$scope.spinnerGet = $http.get(url)
.then
( function successCallback(response)
{
var isAuthenticated = response.data.isAuthenticated;
var authenticationUrl = response.data.authenticationUrl;
if (isAuthenticated)
{
//
// Get data.
//
$scope.spinnerGet = $http.get("Preset?preset=nl-some-query")
.then
( function successCallback(response)
{
var me = response.data.Results[0].Data[0];
var image = me.THUMBNAILPICTURE;
var imageFormat = me.THUMBNAILPICTUREFORMAT;
...
}
, function errorCallback(response)
{
alert('Could not load user information.');
}
);
}
else
{
window.location.href = authenticationUrl;
}
}
, function errorCallback(response)
{
alert('Could not load authentication information.');
}
);
}