BOPAuthenticator provides a bridge between BOP writers and the existing authentication system, this interface defines the SPI.
- Version:
- 17.1.1
- Source:
Methods
invoke(ajaxObject) → {Promise.<operation/js/api/OperationResult>}
stable API
Invokes a remote rest service using the authentication configuration provided to the BOP along with any extra ajax configuration parameters provided. This causes the required authentication headers and proxies to be applied to the request transparently.
A default conversion to OperationResult is provided but these by can of course be override by then/catch and then just returning a new promise with the modified data.
The default setting if no ajax override is provided is a GET request assuming that the any content of of type application/json
Parameters:
Name | Type | Description |
---|---|---|
ajaxObject |
ajaxObject | A JQuery AJAX configuraiton object that can use used to customize the request |
- Version:
- 17.1.1
- Source:
- See:
Returns:
- Promise of the OperationResult for this operation.
- Type
- Promise.<operation/js/api/OperationResult>
Example
var authenticator = this.getBOPAuthenticator();
var performOperation = function (inputData) {
var ajaxObj = {
method: 'POST',
url: dependencies[0].getDefinition().parameters.baseUri + ...,
};
return authenticator.invoke(ajaxObj);
};
var employeeEntity = Abcs.Entities().findById('my.custom.bop.Employee');
var findEmployeesNearlyAtRetirement = new OperationBuilder({
name: 'Query employees ready for retirement',
type: Operation.Type.READ_MANY,
performs: performOperation
}).returns(employeeEntity).build();