Contributor
Contributor

UserSession is Null, but only in the HTML Web Client

We have developed a vCenter plug-in that has worked in 5.0, 5.5, 6.0, and 6.5 using Flex/Flash. 

We've switched to HTML and have noticed a problem when logging in and quickly navigating to our plug-in.

The user gets a null UserSession.  if the user navigates to the vCenter Home page and then back to the plug-in, the UserSession is not null. 

Or if the user "slowly" navigates to our plug-in the UserSession is not null

The problem occurs only in the HTML web client.  The problems has been seen in both the 6.5 and 6.7 HTML web clients. 

The vCenter 6.5 Flex web client doesn't have this issue.

Code snippet:

import com.vmware.vise.usersession.UserSessionService;

...

@Autowired protected UserSessionService userSessionService;

...

UserSession userSession = userSessionService.getUserSession();  <--- returns null (sometimes)

...

2018-05-02 21:53:57 WARN VsphereImpl:332[http-nio-5090-exec-9] - User session is null!  (stack trace snippet)

2018-05-02 21:53:57 ERROR VsphereImpl:186[http-nio-5090-exec-9] - No user session!

com.solidfire.vcp.controller.VsphereException: No user session!

at com.solidfire.vcp.service.VsphereImpl.getAllServers(VsphereImpl.java:333)

Is the UserSession created asynchronously after the user logs in? 

What might cause the UserSession to be null?

     Best Regards,

          Michael

0 Kudos
1 Reply
Contributor
Contributor

I saw that I was mentioned in a posting from 5 months ago, but I'm confused and don't think that the referenced post has anything to do with the issue I'm seeing.  The other issue sounds like a User Session timeout issue (perhaps do to inactivity).  However, the statement "Actually, When we developed any plugin for vCenter, we need to perform authentication with the help of .html pages." in the other issue has no meaning to me (I just don't "get it")  As far as I know, vCenter handles authentication, not me.

My issue would seem to be timing related.  If the user is "quick", vCenter returns null for the UserSession.  If the user is "slow", the UserSession is returned.

Is the construction of the UserSession an asynchronous process that may have not completed by the time a quick user has logged in and navigated to my plug-in?  This issue is not "I waited 30 (or 60 or whatever) minutes and found that my UserSession was null (perhaps because the user was logged out due to inactivity)

     Thanks,

          Michael

0 Kudos