You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@ -0,0 +1,44 @@
|
||||
//----------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//------------------------------------------------------------
|
||||
|
||||
namespace System.ServiceModel
|
||||
{
|
||||
using System;
|
||||
using System.IdentityModel.Claims;
|
||||
using System.IdentityModel.Policy;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
public class DnsEndpointIdentity : EndpointIdentity
|
||||
{
|
||||
public DnsEndpointIdentity(string dnsName)
|
||||
{
|
||||
if (dnsName == null)
|
||||
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("dnsName");
|
||||
|
||||
base.Initialize(Claim.CreateDnsClaim(dnsName));
|
||||
}
|
||||
|
||||
public DnsEndpointIdentity(Claim identity)
|
||||
{
|
||||
if (identity == null)
|
||||
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("identity");
|
||||
|
||||
// PreSharp Bug: Parameter 'identity.ResourceType' to this public method must be validated: A null-dereference can occur here.
|
||||
#pragma warning suppress 56506 // Claim.ClaimType will never return null
|
||||
if (!identity.ClaimType.Equals(ClaimTypes.Dns))
|
||||
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(SR.GetString(SR.UnrecognizedClaimTypeForIdentity, identity.ClaimType, ClaimTypes.Dns));
|
||||
|
||||
base.Initialize(identity);
|
||||
}
|
||||
|
||||
internal override void WriteContentsTo(XmlDictionaryWriter writer)
|
||||
{
|
||||
if (writer == null)
|
||||
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("writer");
|
||||
|
||||
writer.WriteElementString(XD.AddressingDictionary.Dns, XD.AddressingDictionary.IdentityExtensionNamespace, (string)this.IdentityClaim.Resource);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user