Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    Jan 2008
    Location
    HK
    Posts
    16

    Authentication with Metadata Adapter

    I already setup a data adapter to connect my data source and it is working now. But I don't know how to integrate authentication to metadata adapter? For testing purpose, I would like to store user login account on a database. Do you have example to illustrate how to do that?

    According to your document, lightstreamer will send notifySessionClose() to metadata adapter when user logoff. If I want to use that, what can I do?

    Thanks very much,
    Stephen

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    975
    Some general architectural suggestions are available in this FAQ.

    Unfortunately, no code examples are available.
    However, consider that only the "notifyUser" method of the Metadata Adapter is involved in authentication. The other "notify" methods are related to authorization of specific actions (namely, opening of new sessions and subscriptions to items). For instance, by implementing "notifyNewSession" and "notifySessionClose", you can keep track of the number of sessions currently open for each user and block new sessions if some user related limit is reached.

    Note that the "notifyUser" implementation can be blocking, but it should also collect any user authorization information available and cache it, so that the other authorization methods can be nonblocking.

  3. #3
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    517
    Also, see Section 4.1 of "General Concepts.pdf".

  4. #4
    Member
    Join Date
    Sep 2008
    Location
    Varaždin
    Posts
    4
    One question related to subject:
    I want to limit number of opened LS sessions for each user. Therefore, I've implemented methods notifyNewSession and notifySessionClose (increment/decrement counter for every username). Everything works fine with java LS client, but flex client makes things more complicated: I've noticed that flex client tries to open two sessions when stream sense feature can't be turned on. In other words, when connection status is polling (instead of streaming), method notifyNewSession is been called twice. In that case, if I set limit to 1, flex client won't be able to connect to LS server. Is this feature? I can't find this behaviour documented. How to keep track of the number of opened session in this situation?

    Thanks,
    limeni

  5. #5
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    517
    When referring to a single server instance only, there is a solution provided to enable a new session while destroying the previous one (thus covering any case, such as page refresh, stream-sense algorithm, etc.). In the notifyNewSession, you should throw a ConflictingSessionException. In this way, the existing session will be closed, then the new one will pass again through notifyNewSession.

    If you have a server cluster, things get a bit more complicated, as the ConflictingSessionException cannot work across different servers. In this case, you need to force a session termination on a remote server (that is, a different server than the one hosting the Adapter that is handling the notifyNewSession). In this forum thread some techniques for achieving this are outlined. With the current Moderato, Allegro and Presto editions, you can only use Option 1 and Option 3 (but in the future we will enable Option 2 on all the editions). Basically, you should use a DB to keep track of the user / sessionid+server pairs in the cluster and use this information to decide if a session in the cluster should be killed at any time.

 

 

Similar Threads

  1. Replies: 4
    Last Post: October 24th, 2011, 10:33 AM
  2. .Net MetaData Adapter
    By squint in forum Adapter APIs
    Replies: 1
    Last Post: September 10th, 2010, 12:37 PM
  3. Metadata Adapter Question
    By dalmy in forum Adapter APIs
    Replies: 1
    Last Post: July 12th, 2010, 10:38 AM
  4. metadata adapter with user auth example
    By k0nan in forum Adapter APIs
    Replies: 1
    Last Post: May 12th, 2010, 10:50 AM
  5. Multiple Metadata adapter usage
    By stephenlam in forum Client Protocol
    Replies: 5
    Last Post: April 22nd, 2010, 10:19 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 12:08 PM.