SpnEndpointIdentity Classe
Définition
Représente un nom de principal du service (SPN) pour une identité lorsque la liaison utilise Kerberos.Represents a service principal name (SPN) for an identity when the binding uses Kerberos.
public ref class SpnEndpointIdentity : System::ServiceModel::EndpointIdentity
public class SpnEndpointIdentity : System.ServiceModel.EndpointIdentity
type SpnEndpointIdentity = class
inherit EndpointIdentity
Public Class SpnEndpointIdentity
Inherits EndpointIdentity
- Héritage
Exemples
Le code suivant présente un moyen standard de créer une instance de cette classe.The following code shows one common way to create an instance of this class.
static EndpointIdentity CreateIdentity()
{
WindowsIdentity self = WindowsIdentity.GetCurrent();
SecurityIdentifier sid = self.User;
EndpointIdentity identity = null;
if (sid.IsWellKnown(WellKnownSidType.LocalSystemSid) ||
sid.IsWellKnown(WellKnownSidType.NetworkServiceSid) ||
sid.IsWellKnown(WellKnownSidType.LocalServiceSid))
{
identity = EndpointIdentity.CreateSpnIdentity(
String.Format(CultureInfo.InvariantCulture, "host/{0}", GetMachineName()));
}
else
{
// Need an UPN string here
string domain = GetPrimaryDomain();
if (domain != null)
{
string[] split = self.Name.Split('\\');
if (split.Length == 2)
{
identity = EndpointIdentity.CreateUpnIdentity(split[1] + "@" + domain);
}
}
}
return identity;
}
Private Shared Function CreateIdentity() As EndpointIdentity
Dim self As WindowsIdentity = WindowsIdentity.GetCurrent()
Dim sid As SecurityIdentifier = self.User
Dim identity As EndpointIdentity = Nothing
If sid.IsWellKnown(WellKnownSidType.LocalSystemSid) OrElse sid.IsWellKnown(WellKnownSidType.NetworkServiceSid) OrElse sid.IsWellKnown(WellKnownSidType.LocalServiceSid) Then
identity = EndpointIdentity.CreateSpnIdentity(String.Format(CultureInfo.InvariantCulture, "host/{0}", GetMachineName()))
Else
' Need an UPN string here
Dim domain As String = GetPrimaryDomain()
If domain IsNot Nothing Then
Dim split() As String = self.Name.Split("\"c)
If split.Length = 2 Then
identity = EndpointIdentity.CreateUpnIdentity(split(1) & "@" & domain)
End If
End If
End If
Return identity
End Function
Remarques
Un SPN est le nom par lequel un client identifie de manière unique une instance d'un service.An SPN is the name by which a client uniquely identifies an instance of a service. Si vous installez plusieurs instances d'un service sur les ordinateurs d'une forêt, chaque instance doit posséder son propre SPN.If you install multiple instances of a service on computers throughout a forest, each instance must have its own SPN. Une instance de service donnée peut posséder plusieurs noms SPN si les clients peuvent utiliser plusieurs noms pour l'authentification.A given service instance can have multiple SPNs if there are multiple names that clients might use for authentication.
Lorsqu'un client souhaite se connecter à un service, il localise une instance du service, compose un SPN pour cette instance et affecte SpnEndpointIdentity à l'identité.When a client wants to connect to a service, it locates an instance of the service, composes an SPN for that instance, and sets the identity to a SpnEndpointIdentity. Un contrôle permettra de s'assurer que le message est bien destiné à ce service.A check will be made that the message is intended for that service.
Les trois modes d'authentification utilisés sous Kerberos sont :The three authentication modes used under Kerberos are:
SSPINegotiateSSPINegotiate
KerberosKerberos
KerberosOverTransport.KerberosOverTransport.
Constructeurs
SpnEndpointIdentity(Claim) |
Initialise une nouvelle instance de la classe SpnEndpointIdentity avec la revendication d'identité spécifiée.Initializes a new instance of SpnEndpointIdentity with the specified identity claim. |
SpnEndpointIdentity(String) |
Initialise une nouvelle instance de SpnEndpointIdentity avec le nom de principal du service (SPN) spécifié.Initializes a new instance of SpnEndpointIdentity with the specified service principal name (SPN). |
Propriétés
IdentityClaim |
Obtient la revendication d'identité qui correspond à l'identité.Gets the identity claim that corresponds to the identity. (Hérité de EndpointIdentity) |
SpnLookupTime |
Spécifie la durée maximale de recherche autorisée pour le nom de principal du service (SPN).Specifies the maximum time allowed to look up the service principal name (SPN). |
Méthodes
Equals(Object) |
Retourne une valeur qui détermine si l'objet spécifié est égal à l'objet d'identité actuel ou s'ils ont des propriétés de sécurité identiques.Returns a value that determines whether a specified object is equal to the current identity object or if they have equal security properties. (Hérité de EndpointIdentity) |
GetHashCode() |
Fournit un code de hachage pour l'instance actuelle de l'identité.Provides a hash code for the current instance of the identity. (Hérité de EndpointIdentity) |
GetType() |
Obtient le Type de l'instance actuelle.Gets the Type of the current instance. (Hérité de Object) |
Initialize(Claim) |
Initialise une EndpointIdentity avec la revendication spécifiée.Initializes an EndpointIdentity with the specified claim. (Hérité de EndpointIdentity) |
Initialize(Claim, IEqualityComparer<Claim>) |
Initialise une EndpointIdentity avec la revendication spécifiée et une interface et compare l'égalité.Initializes an EndpointIdentity with the specified claim and an interface and compares equality. (Hérité de EndpointIdentity) |
MemberwiseClone() |
Crée une copie superficielle du Object actuel.Creates a shallow copy of the current Object. (Hérité de Object) |
ToString() |
Retourne l'identité.Returns the identity. (Hérité de EndpointIdentity) |