本文整理匯總了C#中System.ServiceModel.EndpointAddress.GetType方法的典型用法代碼示例。如果您正苦於以下問題:C# EndpointAddress.GetType方法的具體用法?C# EndpointAddress.GetType怎麽用?C# EndpointAddress.GetType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.ServiceModel.EndpointAddress
的用法示例。
在下文中一共展示了EndpointAddress.GetType方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ValidateAppliesTo
//protected override SecurityTokenDescriptor CreateSecurityTokenDescriptor(RequestSecurityToken request, Scope scope)
//{
// StreamWriter file = new StreamWriter("c:\\temp\\IdentityProviderSts.CustomSecurityTokenService - CreateSecurityTokenDescriptor.txt", true);
// file.WriteLine("_________________________________________");
// file.WriteLine("DateTime: " + DateTime.Now.ToString());
// SecurityTokenDescriptor descriptor = null;
// try
// {
// descriptor = base.CreateSecurityTokenDescriptor(request, scope);
// if (descriptor == null)
// {
// file.WriteLine("descriptor: " + "null");
// }
// if (descriptor.Subject == null)
// {
// file.WriteLine("descriptor.Subject: " + "null");
// }
// string authType = Saml2Constants.AuthenticationContextClasses.Password.ToString();
// DateTime now = DateTime.UtcNow;
// if (string.IsNullOrEmpty(authType))
// {
// file.WriteLine("authType: " + "null");
// }
// else
// {
// file.WriteLine("authType: " + authType);
// file.WriteLine("now: " + now.ToString());
// descriptor.AddAuthenticationClaims( authType, now);
// }
// }
// catch (Exception e)
// {
// file.WriteLine("Exception: " + e.Message);
// if (e.InnerException != null)
// {
// file.WriteLine("InnerException: " + e.InnerException.Message);
// }
// throw;
// }
// finally
// {
// if (file != null)
// {
// file.Close();
// }
// }
// return descriptor;
//}
/// <summary>
/// Validates appliesTo and throws an exception if the appliesTo is null or contains an unexpected address.
/// </summary>
/// <param name="appliesTo">The AppliesTo value that came in the RST.</param>
/// <exception cref="ArgumentNullException">If 'appliesTo' parameter is null.</exception>
/// <exception cref="InvalidRequestException">If 'appliesTo' is not valid.</exception>
void ValidateAppliesTo(EndpointAddress appliesTo)
{
if (appliesTo == null)
{
throw new ArgumentNullException("appliesTo");
}
if (appliesTo != null)
{
Type type = appliesTo.GetType();
}
// TODO: Enable AppliesTo validation for allowed relying party Urls by setting enableAppliesToValidation to true. By default it is false.
if (enableAppliesToValidation)
{
bool validAppliesTo = false;
foreach (string rpUrl in ActiveClaimsAwareApps)
{
if (appliesTo.Uri.Equals(new Uri(rpUrl)))
{
validAppliesTo = true;
break;
}
}
if (!validAppliesTo)
{
throw new InvalidRequestException(String.Format("The 'appliesTo' address '{0}' is not valid.", appliesTo.Uri.OriginalString));
}
}
}