Results 1 to 5 of 5

Hybrid View

  1. #1

    Access Token Info from Metadata Adapter in DataAdapter?

    Hello,

    I am currently working on a Metadata and DataAdapter for my project, but am running into a slight problem.

    When a user authenticates with LS, it is hitting NotifyUser in my Metadata Adapter, where I am validating their token. All good so far.

    However, in our DataAdapter, the way that our event subscription works is that I need to pass in a UserId in order to create a subscription. This UserId is available in the token itself.

    Is there a way for the Metadata Adapter to pass information to the DataAdapter for use? Or is there a better way to do this?

    Thanks,
    Tanner

  2. #2
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Hi Tanner,

    The original design of the Metadata and Data Adapter interfaces provides that any matters regarding authentication, authorization and QoS are addressed to the Metadata Adapter while the Data Adapter deals exclusively with application data.
    And that is why information about the client session (ie. the user) is provided to the Metadata methods but not to the Data methods.
    In particular case of subscription request if you need the user's information to authorize the request or not or to tune its characteristics depending the user, the right methods to do this are: notifyNewTables, getAllowedMaxItemFrequency, isModeAllowed,getAllowedBufferSize.
    And not the subscribe method of Data Adapter.

    That said, if you actually need user information also in the subscribe method a possible solution is to leverage the getItems method of the Metadata interface.
    That means that all the clients subscribe to the same Item name but in the getItems method your custom implementation will return a decorated name with user information; something like 'itemName_userId' or 'itemName_userToken'.
    So the subscribe Method of the Data Adapter will receive the Item name decorated and can retrieve the user information.

    Please let me know if that makes sense for you.

    Regards,
    Giuseppe

  3. #3
    Thank you for the clarifications on this. As such, we have decided to refactor, and remove our dependency on the UserId in this case.

    Thanks,
    Tanner

  4. #4
    Hi Giuseppe,

    Is it true that if I modify the itemName in getItems that it will effect the subscription itself?

    For example, it turns out we do need some user information for our scenario. As such, I have an http client that is subscribing to 'itemName'. I am catching this subscription with getItems, and updating it to be 'itemName_userId'. However, now when I post updates to 'itemName' the client no longer receives the data. Is this because LS thinks the client is actually subscribed to 'itemName_userId' instead of just 'itemName'?

    Thanks,
    Tanner

  5. #5
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    Hi Tanner,

    I can confirm that in a similar case, the Data Adapter should use the 'itemName_userId' name to push updates.

    However, regardless of what happens in the Metadata, the Data Adapter must always refer to the name of the Item received in the subscribe call.

    Regards,
    Giuseppe

 

 

Similar Threads

  1. Replies: 4
    Last Post: October 24th, 2011, 10:33 AM
  2. Sample code for multiple data adapter access
    By h2c357 in forum Client SDKs
    Replies: 1
    Last Post: September 8th, 2011, 09:55 AM
  3. Replies: 4
    Last Post: February 3rd, 2011, 11:33 AM
  4. Replies: 4
    Last Post: February 5th, 2010, 04:12 PM
  5. Authentication with Metadata Adapter
    By stephenlam in forum Adapter SDKs
    Replies: 4
    Last Post: December 12th, 2008, 11:52 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 01:32 PM.