private static string SafeUriBuilderToString(UriBuilder realmUriBuilder) {
Requires.NotNull(realmUriBuilder, "realmUriBuilder");
// Note: we MUST use ToString. Uri property throws if wildcard is present.
// Note that Uri.ToString() should generally be avoided, but UriBuilder.ToString()
// is safe: http://blog.nerdbank.net/2008/04/uriabsoluteuri-and-uritostring-are-not.html
return realmUriBuilder.ToString();
}