bluvo

Solved: Exception when calling GetCurrentUserID (c#)

Recommended Posts

Hello,

 

i have an application to check the current users presence state. But with some users i have a problem to get the current user id.

I use the following code:
 

var libManager = new SWConfigDataClientLib.LibManager(false);
libManager.BaseProtocol = SWConfigDataClientLib.SProxyObject.BaseProtocol.TCP;

libManager.AuthenticationMode = SWConfigDataClientLib.SProxyObject.AuthenticationMode.Trusted;
libManager.Username = "";
libManager.Password = "";

libManager.WSBaseUrl = "swyxsrv";

var facade = libManager.GetPhoneClientFacade();

var id = facade.GetCurrentUserID(); // <= throw the following exception

 

Access Denied: The User ... has insufficient privileges for this operation. (SSecurityAccessException)
   bei SWConfigDataWSLib.Security.SWSSecurityManager.AssertCallingPrincipalRole(IPrincipal principal, String roleName)
   bei SWConfigDataWSLib.Security.SWSSecurityManager.AssertCallingPrincipalRole(BuildInRoles role)
   bei SWConfigDataWSLib.WebServices.CPhoneClientFacadeImpl.GetCurrentUserID() (SWConfigDataSharedLib.Exceptions.SSecurityAccessException)

 

The user is member of the system administrator group in SwyxWare, so what is going wrong?

Share this post


Link to post
Share on other sites

Hello,

 

the "AuthenticationMode" is wrong. If you want to use a username and a password for authentication you have to use the "SProxyObject.AuthenticationMode.UsernamePassword".

"SWConfigDataClientLib.SProxyObject.AuthenticationMode.Trusted" have to be used for Windows Authentication.

 

Kind regards

 

Sebastian Dreier

Share this post


Link to post
Share on other sites

Hello,

 

i want to use windows authentication. Is it wrong to clear username and passwort properties?

 

Regards

 

Thomas

Share this post


Link to post
Share on other sites

Hello,

 

oh that was a misunderstanding....
If you do not use the username/password authentication I recommend that you do not set the username and the password property but this is not the source of your problem.


Are you sure that your application is running in the correct Windows user account context?
Did you add the correct Windows account to the System Administrator group?

Furthermore if you want to use the PhoneClient facade you MUST have a SwyxWare user context. This means that you have to assign the Windows Account to a SwyxWare user (can be a dummy user without phone number) otherwise the some methods on the PhoneClient facade are not usable (throw exceptions).

 

Kind regards

 

Sebastian Dreier

Share this post


Link to post
Share on other sites

Hello,

 

the application is running in the correct windows account, the same windows account is member of the system administrator group in SwyxWare.

There is also a swyx user with this windows account assigned.

 

Is it a problem, when this swyx user is assigned with more than one windows account?

Share this post


Link to post
Share on other sites

Please assign the Windows account to one SwyxWare user only and give the SwyxWare user System Admin rights (just for a test).
 

By the way: What SwyxWare do you use (SwyxWare 11 or 2015 R40.3)?

Please not that the SwyxWare 2015 SDK (CDS binaries) are not compatible with SwyxWare 11. The new SDK (incl. the CDS binaries) will be released soon.

Share this post


Link to post
Share on other sites

Hello,

 

i've already checked this points:

  • Application is running under the correct windows account
  • Authentication mode is set to Trusted
  • The windows account is assigned to a swyx user, the swyx user has only this one windows account
  • Using the current CDS SDK 2015 R40.3 assemblies
  • The windows user is in the Swyxware System Administrator group
  • The swyx user has System Administrator profile

I've run the app with different users, for some it works, for some not.

 

Supplement:

It seems to be neccessary, that the windows account is assigned to only one swyx user.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now