예제 #1
0
 public static string GetAuthorizationHeaderUser(UserCredential cred)
 {
     using (ACSClient client = new ACSClient(ConfigManager.GetValue("ACSService")))
     {
         var resultTokenCache = GetExistsToken(cred.Name, cred.Password);
         if (null == resultTokenCache)
         {
             var loginResult = client.Login(cred);
             var token       = loginResult.AccessToken.AuthorizationHeader;
             CreateCacheToken(cred.Name, cred.Password, loginResult.AccessToken.ExpiresOn, token);
             return(token);
         }
         else
         {
             return(resultTokenCache.Token);
         }
     }
 }
예제 #2
0
 public static string GetAuthorizationHeader(string user, string pass)
 {
     using (ACSClient client = new ACSClient(ConfigManager.GetValue("ACSService")))
     {
         var resultTokenCache = GetExistsToken(user, pass);
         if (null == resultTokenCache)
         {
             var loginResult = client.Login(new ServiceCredential()
             {
                 Name = user, Password = pass
             });
             var token = loginResult.AccessToken.AuthorizationHeader;
             CreateCacheToken(user, pass, loginResult.AccessToken.ExpiresOn, token);
             return(token);
         }
         else
         {
             return(resultTokenCache.Token);
         }
     }
 }