KerberosRequestorSecurityToken Constructor (String, TokenImpersonationLevel, NetworkCredential, String)
Initializes a new instance of the KerberosRequestorSecurityToken class.
Assembly: System.IdentityModel (in System.IdentityModel.dll)
public:
KerberosRequestorSecurityToken(
String^ servicePrincipalName,
TokenImpersonationLevel tokenImpersonationLevel,
NetworkCredential^ networkCredential,
String^ id
)
Parameters
- servicePrincipalName
- Type: System::String
The service principal name for the KerberosRequestorSecurityToken security token. Sets the ServicePrincipalName property.
- tokenImpersonationLevel
- Type: System.Security.Principal::TokenImpersonationLevel
One of the TokenImpersonationLevel values that specifies how the client allows the KerberosRequestorSecurityToken security token to be impersonated.
- networkCredential
- Type: System.Net::NetworkCredential
A NetworkCredential that specifies the user to get a KerberosRequestorSecurityToken security token for.
- id
- Type: System::String
A unique identifier of the security token. Sets the value of the Id property.
| Exception | Condition |
|---|---|
| ArgumentNullException | servicePrincipalName is nullptr. -or- id is nullptr. |
| ArgumentException | networkCredential is not nullptr, not equal to DefaultNetworkCredentials and the UserName property is empty or nullptr. |
| SecurityTokenException | A Kerberos ticket cannot be obtained for the specified user. |
| ArgumentOutOfRangeException | tokenImpersonationLevel is not Impersonation or Identity. |
The service principal name must be in one of the following formats: host/<hostname>@<domain> or <hostname>, where hostname is the name of the computer hosting the target Web service and domain is the fully-qualified domain name of the Kerberos realm in which the host computer resides. The service principal name is associated with an account that is running the service and this mapping is stored in the Kerberos Domain Controller (KDC).
When nullptr is passed into the networkCredential parameter, a KerberosRequestorSecurityToken security token is obtained for the current user.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.