暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AuthToken.cs 1.1KB

123456789101112131415161718192021222324252627282930313233
  1. using Codice.Client.Common;
  2. namespace Unity.PlasticSCM.Editor.Tool
  3. {
  4. internal static class AuthToken
  5. {
  6. internal static string GetForServer(string server)
  7. {
  8. ServerProfile serverProfile = CmConnection.Get().
  9. GetProfileManager().GetProfileForServer(server);
  10. string authToken = serverProfile != null ?
  11. CmConnection.Get().
  12. BuildWebApiTokenForCloudEditionForUser(
  13. serverProfile.Server,
  14. serverProfile.GetSEIDWorkingMode(),
  15. serverProfile.SecurityConfig):
  16. CmConnection.Get().
  17. BuildWebApiTokenForCloudEditionForUser(
  18. server,
  19. ClientConfig.Get().GetSEIDWorkingMode(),
  20. ClientConfig.Get().GetSecurityConfig());
  21. if (string.IsNullOrEmpty(authToken))
  22. {
  23. authToken = CmConnection.Get().
  24. BuildWebApiTokenForCloudEditionDefaultUser();
  25. }
  26. return authToken;
  27. }
  28. }
  29. }