本文整理汇总了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));
}
}
}