internal static SecurityToken GetMessagingToken(this TokenProvider tokenProvider, Uri namespaceAddress, string appliesTo, string action, bool bypassCache, TimeSpan timeout) { SecurityToken securityToken; try { TimeSpan timeSpan = TimeoutHelper.Min(timeout, TokenProviderUtility.MaxGetTokenSyncTimeout); securityToken = tokenProvider.EndGetToken(tokenProvider.BeginGetToken(namespaceAddress, appliesTo, action, bypassCache, timeSpan, null, null)); } catch (TimeoutException timeoutException) { throw; } catch (TokenProviderException tokenProviderException1) { TokenProviderException tokenProviderException = tokenProviderException1; throw new MessagingException(tokenProviderException.Message, tokenProviderException); } catch (Exception exception1) { Exception exception = exception1; if (!Fx.IsFatal(exception)) { throw new UnauthorizedAccessException(exception.Message, exception); } throw; } return(securityToken); }
internal static SecurityToken EndGetMessagingToken(this TokenProvider tokenProvider, IAsyncResult result) { Exception exception; SecurityToken securityToken; try { securityToken = tokenProvider.EndGetToken(result); } catch (Exception exception1) { if (TokenProviderUtility.HandleTokenException(exception1, out exception)) { throw exception; } throw; } return(securityToken); }
internal static SecurityToken GetToken(this TokenProvider tokenProvider, string appliesTo, string action, bool bypassCache, TimeSpan timeout) { TimeSpan timeSpan = TimeoutHelper.Min(timeout, TokenProviderUtility.MaxGetTokenSyncTimeout); return(tokenProvider.EndGetToken(tokenProvider.BeginGetToken(appliesTo, action, bypassCache, timeSpan, null, null))); }