SpnEndpointIdentity Construtores
Definição
Inicializa uma nova instância de SpnEndpointIdentity.Initializes a new instance of SpnEndpointIdentity.
Sobrecargas
| SpnEndpointIdentity(Claim) |
Inicializa uma nova instância de SpnEndpointIdentity com a declaração de identidade especificada.Initializes a new instance of SpnEndpointIdentity with the specified identity claim. |
| SpnEndpointIdentity(String) |
Inicializa uma nova instância de SpnEndpointIdentity com o SPN (nome da entidade de serviço) especificado.Initializes a new instance of SpnEndpointIdentity with the specified service principal name (SPN). |
SpnEndpointIdentity(Claim)
Inicializa uma nova instância de SpnEndpointIdentity com a declaração de identidade especificada.Initializes a new instance of SpnEndpointIdentity with the specified identity claim.
public:
SpnEndpointIdentity(System::IdentityModel::Claims::Claim ^ identity);
public SpnEndpointIdentity (System.IdentityModel.Claims.Claim identity);
new System.ServiceModel.SpnEndpointIdentity : System.IdentityModel.Claims.Claim -> System.ServiceModel.SpnEndpointIdentity
Public Sub New (identity As Claim)
Parâmetros
- identity
- Claim
A identidade para este SPN (nome da entidade de serviço).The identity for this service principal name (SPN).
Exceções
identity é null.identity is null.
Exemplos
O código a seguir mostra como criar identidades de um conjunto de declarações.The following code shows how to create identities from a set of claims.
private SpnEndpointIdentity CreateIdentityFromClaimSet(ClaimSet claims)
{
foreach (Claim claim in claims.FindClaims(null, Rights.Identity))
{
return new SpnEndpointIdentity(claim);
}
return null;
}
Private Function CreateIdentityFromClaimSet(ByVal claims As ClaimSet) As SpnEndpointIdentity
For Each claim As Claim In claims.FindClaims(Nothing, Rights.Identity)
Return New SpnEndpointIdentity(claim)
Next claim
Return Nothing
End Function
Comentários
Esse construtor define a SpnLookupTime propriedade como 1 minuto.This constructor sets the SpnLookupTime property to 1 minute.
Aplica-se a
SpnEndpointIdentity(String)
Inicializa uma nova instância de SpnEndpointIdentity com o SPN (nome da entidade de serviço) especificado.Initializes a new instance of SpnEndpointIdentity with the specified service principal name (SPN).
public:
SpnEndpointIdentity(System::String ^ spnName);
public SpnEndpointIdentity (string spnName);
new System.ServiceModel.SpnEndpointIdentity : string -> System.ServiceModel.SpnEndpointIdentity
Public Sub New (spnName As String)
Parâmetros
- spnName
- String
O SPN.The SPN.
Exceções
spnName é null.spnName is null.
Exemplos
O código a seguir mostra como criar identidades de uma representação de cadeia de caracteres do SPN.The following code shows how to create identities from a string representation of the SPN.
static EndpointIdentity CreateSpnIdentity()
{
WindowsIdentity self = WindowsIdentity.GetCurrent();
SecurityIdentifier sid = self.User;
SpnEndpointIdentity identity = null;
identity = new SpnEndpointIdentity(String.Format(CultureInfo.InvariantCulture, "host/{0}", GetMachineName()));
return identity;
}
static string GetMachineName()
{
return Dns.GetHostEntry(string.Empty).HostName;
}
Private Shared Function CreateSpnIdentity() As EndpointIdentity
Dim self As WindowsIdentity = WindowsIdentity.GetCurrent()
Dim sid As SecurityIdentifier = self.User
Dim identity As SpnEndpointIdentity = Nothing
identity = New SpnEndpointIdentity(String.Format(CultureInfo.InvariantCulture, "host/{0}", GetMachineName()))
Return identity
End Function
Private Shared Function GetMachineName() As String
Return Dns.GetHostEntry(String.Empty).HostName
End Function
Comentários
Esse construtor define a SpnLookupTime propriedade como 1 minuto.This constructor sets the SpnLookupTime property to 1 minute.