[progress Communities] [progress Openedge Abl] Forum Post: Re: [jsdo V4.4] Xmlhttprequest...

  • Thread starter Thread starter aestrada
  • Start date Start date
Status
Not open for further replies.
A

aestrada

Guest
In versions before 4.4, the JSDOSession object had too many responsibilities. It handled both authentication and session management. For clarity and maintainability, the JSDOSession was split. The AuthenticationProvider object was created to handle authentication of the user. All current authentication models are supported, with the potential of handling new ones like oauth. The JSDOSession now only manages the user’s session and will now require an AuthenticationProvider whenever it is being instantiated. Here's some sample code: var session, auth; auth = new progress.data.AuthenticationProvider( { authenticationModel: progress.data.Session.AUTH_TYPE_FORM, uri: " http://1.1.1.1:8810/Customer/" }); auth.login("user", "password") .then(function() { session = new progress.data.JSDOSession({ authenticationModel: progress.data.Session.AUTH_TYPE_FORM, serviceURI: " http://1.1.1.1:8810/Customer/" , authProvider: auth }); return session.isAuthorized(); }) .then(function (session, result, info) { return session.addCatalog(" 1.1.1.1:8810/.../CustomerService.json"); }) .then(function (s, r, i) { jsdo = new progress.data.JSDO({ name: 'Customer' }); jsdo.subscribe('AfterFill', onAfterFillCustomers, this); jsdo.fill(); function onAfterFillCustomers(jsdo, success, request) { jsdo.ttCustomer.foreach(function(customer) { document.write(customer.data.CustNum + ' ' + customer.data.Name + ' '); }); } }); Some extra things to note are that JSDOSession.login() and logout() have been officially deprecated. We recommend the usage of the new AuthenticationProvider model or even getSession(), which will handle the creation of AuthenticationProviders for you. The Session object also has been deprecated. Please use the JSDOSession object instead. An AuthenticationProvider can also be shared by multiple JSDOSessions, it's not limited to just one. The official documentation is on the way.

Continue reading...
 
Status
Not open for further replies.
Back
Top