예제 #1
0
 public IAsyncResult BeginGetToken(AsyncCallback callback, object asyncState)
 {
     if (HttpContext.Current.Session[cacheKey] == null) {
         // The maximum allowable token duration is 480 minutes (8 hours).
         // The minimum allowable duration is 15 minutes.
         var tokenSpec = new TokenSpecification {
             ClientIPAddress = HttpContext.Current.Request.UserHostAddress,
             TokenValidityDurationMinutes = 60
         };
         //IPv6 fix for local dev
         if (tokenSpec.ClientIPAddress == "::1")
         {
             tokenSpec.ClientIPAddress = "127.0.0.1";
         }
         return commonservice.BeginGetClientToken(tokenSpec, callback, asyncState);
     }
     //complete the Async call immediately with the cached value
     var asyncResult = new CompletedAsyncResult((string)HttpContext.Current.Session[cacheKey], callback, asyncState);
     ThreadPool.QueueUserWorkItem(Callback, asyncResult);
     return asyncResult;
 }
예제 #2
0
 public IAsyncResult BeginGetClientToken(TokenSpecification tokenSpec, AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("GetClientToken", new object[] { tokenSpec }, callback, asyncState);
 }
예제 #3
0
 /// <remarks/>
 public void GetClientTokenAsync(TokenSpecification specification, object userState) {
     if ((this.GetClientTokenOperationCompleted == null)) {
         this.GetClientTokenOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetClientTokenOperationCompleted);
     }
     this.InvokeAsync("GetClientToken", new object[] {
                 specification}, this.GetClientTokenOperationCompleted, userState);
 }
예제 #4
0
 /// <remarks/>
 public void GetClientTokenAsync(TokenSpecification specification) {
     this.GetClientTokenAsync(specification, null);
 }
예제 #5
0
 public string GetClientToken(TokenSpecification specification) {
     object[] results = this.Invoke("GetClientToken", new object[] {
                 specification});
     return ((string)(results[0]));
 }