[THIN] Get client name in WI4

  • From: "Evan Mann" <emann@xxxxxxxxxxxxxxxxxxxxx>
  • To: <thin@xxxxxxxxxxxxx>
  • Date: Thu, 18 Aug 2005 12:12:37 -0400

Just wanted to pass along that I tried this method below, which was
posted by another person (forget who, sorry!) and it works nicely thus
far.  

All the printers now show up as domain-username.  That doesn't match
exactly with what was mentioned below as the original poster said they
only see the username.  I would ideally like ONLY the username, so can
anyone tell me what I should tweak to have it show only the username?
Perhaps it's a back end setting and not something I need to change in
the code?

---------------
I saw that someone already responded with the published Citrix
solution, however that method disables workspace control.

We therefore took a different route:  We modified the Session.cs file
and left workspace control enabled.  Now we get User Name (not
domain-username) for the Client ID AND we have workspace control
still.

We are still testing this method to assure no other problems, but so
far it looks good.

Session.cs info:

Here is the original Code

Change these lines to decide how the client name is chosen:

    // Get the client name to use (create a new one, if necessary)
    String clientName =
(String)deviceState.get(COOKIE_LOGIN_CLIENT_NAME);
    if (!MPSClientNames.isValidUniqueName(clientName)) {
        if( config.getWorkspaceControlConfiguration().getEnabled() ) {
            clientName = MPSClientNames.generateUnique();
            deviceState.put(COOKIE_LOGIN_CLIENT_NAME, clientName); //
Remember for future sessions
        } else {
            // Use the old client name format when Workspace Control is
disabled for
            // compatibility (MPS/U and MF1.8 need the old format to do
roaming
            // reconnection).
            clientName = MPSClientNames.fromAccessToken( accessToken );
        }
    }

For example, replacing the lines above with this should always use the
client name derived from the username:

    // Always determine the client name from the user's identity
    String clientName = MPSClientNames.fromAccessToken( accessToken );
------------------------

Other related posts: