Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Mar 2007
    Location
    Boston
    Posts
    26

    NotifyNewSession

    Hi,
    I have a question regarding public void notifyNewSession(java.lang.String user, java.lang.String session, java.util.Map clientContext) of MetsdataProviderAdapter class. Where does the data of clientContext come from? Also is clientContext cached in memory and accessable later by Metadata Adapter or Data Adapter? If yes, how?

    Thanks

    Eric

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    958
    The clientContext is a collection of available information about the client that is requesting a new session.
    It is provided just in case, as information that might be useful in order to decide whether the request to open the session (or any other request related to the session) can be accepted.
    The information is, therefore, associated to the specific session. However, it is not cached. Any caching for use in later operations must be performed by the Metadata Adapter.

  3. #3
    Member
    Join Date
    Mar 2007
    Location
    Boston
    Posts
    26
    Thanks, Dario.
    Is there a list of data fields saved in ClientContext? Also, if I want to pass the data I get from Http Headers (unique to each session) from the call notifyUser(User,Password, http_headers) to notifyNewSession(User, LS_session, clientContext) what is the best way to do due to the fact that the same user id can be used for multiple connections/sessions?

    Thanks again.

    Eric

  4. #4
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    958
    I can't understand your question
    Is there a list of data fields saved in ClientContext?
    Anyway, the clientContext contents are documented in the notifyNewSession javadoc.

    You are right. There is no way to strictly associate a call to notifyUser with the calls to notifyNewSession and other methods related with the management of the same session request, hence the httpHeaders argument cannot be exported to those methods.
    We introduced httpHeaders to support authentication based on cookies, but we thought that authorization tasks would not depend on such information after the user identity had been checked.

    We will close this gap in the next release.
    In the meantime, you might try to differentiate client requests by decorating the user name on the client side in some way.

  5. #5
    Member
    Join Date
    May 2018
    Location
    Athens, Greece
    Posts
    5
    Hello,

    Quote Originally Posted by DarioCrivelli View Post
    In the meantime, you might try to differentiate client requests by decorating the user name on the client side in some way.
    Is this still the way to do it?

  6. #6
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    958
    Hi, Thank you for reminding us of this pending thread.
    We overcame the issue short time later, although in a tricky way, to avoid altering the interface.

    Now, if you gather some information on the user in notifyUser, you can have this information passed to the subsequent and corresponding invocation of notifyNewSession by leveraging the "httpHeaders" Map.
    In fact, we guarantee (and document) that the "HTTP_HEADERS" Map that is contained in the "clientContext" Map received by notifyNewSession is the same instance as the "HttpHeaders" Map received by notifyUser.

    So, you can use that Map as a bridge and overload it with any other data computed in notifyUser.
    In the rare cases in which notifyUser is not followed by notifyNewSession because of errors in the middle, the Map will be garbage-collected.

    We hope that this is manageable in most cases.

 

 

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 09:12 AM.