/// <summary> /// Create an instance of current class according to specified ulType_Values. /// </summary> /// <param name="ulType">The specified ulType_Values.</param> /// <returns>The created instance of current class.</returns> private static PacInfoBuffer CreatePacInfoBuffer(PAC_INFO_BUFFER_Type_Values ulType) { PacInfoBuffer pacInfoBuffer; switch (ulType) { case PAC_INFO_BUFFER_Type_Values.LogonInformation: pacInfoBuffer = new KerbValidationInfo(); break; case PAC_INFO_BUFFER_Type_Values.CredentialsInformation: pacInfoBuffer = new PacCredentialInfo(); break; case PAC_INFO_BUFFER_Type_Values.ServerChecksum: pacInfoBuffer = new PacServerSignature(); break; case PAC_INFO_BUFFER_Type_Values.KdcChecksum: pacInfoBuffer = new PacKdcSignature(); break; case PAC_INFO_BUFFER_Type_Values.ClientNameAndTicketInformation: pacInfoBuffer = new PacClientInfo(); break; case PAC_INFO_BUFFER_Type_Values.ConstrainedDelegationInformation: pacInfoBuffer = new S4uDelegationInfo(); break; case PAC_INFO_BUFFER_Type_Values.UpnAndDnsInformation: pacInfoBuffer = new UpnDnsInfo(); break; case PAC_INFO_BUFFER_Type_Values.ClientClaimsInformation: pacInfoBuffer = new ClientClaimsInfo(); break; case PAC_INFO_BUFFER_Type_Values.PacDeviceInfo: pacInfoBuffer = new PacDeviceInfo(); break; case PAC_INFO_BUFFER_Type_Values.DeviceClaimsInformation: pacInfoBuffer = new DeviceClaimsInfo(); break; default: throw new ArgumentOutOfRangeException("ulType"); } return(pacInfoBuffer); }
/// <summary> /// Creates an S4uDelegationInfo instance using the specified s4U2proxyTarget and /// s4UTransitedServices. /// </summary> /// <param name="s4U2proxyTarget">the name of the principal to whom the application /// can be constraint delegated.</param> /// <param name="s4UTransitedServices">The list of all services that configured to /// be delegated.</param> /// <returns>The created S4uDelegationInfo instance.</returns> public static S4uDelegationInfo CreateS4uInfoBuffer( string s4U2proxyTarget, params string[] s4UTransitedServices) { S4uDelegationInfo s4uInfo = new S4uDelegationInfo(); s4uInfo.NativeS4uDelegationInfo.S4U2proxyTarget = DtypUtility.ToRpcUnicodeString(s4U2proxyTarget); s4uInfo.NativeS4uDelegationInfo.TransitedListSize = (uint)s4UTransitedServices.Length; _RPC_UNICODE_STRING[] transitedServiceArray = new _RPC_UNICODE_STRING[s4UTransitedServices.Length]; for (int i = 0; i < transitedServiceArray.Length; i++) { transitedServiceArray[i] = DtypUtility.ToRpcUnicodeString(s4UTransitedServices[i]); } s4uInfo.NativeS4uDelegationInfo.S4UTransitedServices = transitedServiceArray; return(s4uInfo); }
/// <summary> /// Create an instance of current class according to specified ulType_Values. /// </summary> /// <param name="ulType">The specified ulType_Values.</param> /// <returns>The created instance of current class.</returns> private static PacInfoBuffer CreatePacInfoBuffer(PAC_INFO_BUFFER_Type_Values ulType) { PacInfoBuffer pacInfoBuffer; switch (ulType) { case PAC_INFO_BUFFER_Type_Values.LogonInformation: pacInfoBuffer = new KerbValidationInfo(); break; case PAC_INFO_BUFFER_Type_Values.CredentialsInformation: pacInfoBuffer = new PacCredentialInfo(); break; case PAC_INFO_BUFFER_Type_Values.ServerChecksum: pacInfoBuffer = new PacServerSignature(); break; case PAC_INFO_BUFFER_Type_Values.KdcChecksum: pacInfoBuffer = new PacKdcSignature(); break; case PAC_INFO_BUFFER_Type_Values.ClientNameAndTicketInformation: pacInfoBuffer = new PacClientInfo(); break; case PAC_INFO_BUFFER_Type_Values.ConstrainedDelegationInformation: pacInfoBuffer = new S4uDelegationInfo(); break; case PAC_INFO_BUFFER_Type_Values.UpnAndDnsInformation: pacInfoBuffer = new UpnDnsInfo(); break; case PAC_INFO_BUFFER_Type_Values.ClientClaimsInformation: pacInfoBuffer = new ClientClaimsInfo(); break; case PAC_INFO_BUFFER_Type_Values.PacDeviceInfo: pacInfoBuffer = new PacDeviceInfo(); break; case PAC_INFO_BUFFER_Type_Values.DeviceClaimsInformation: pacInfoBuffer = new DeviceClaimsInfo(); break; default: throw new ArgumentOutOfRangeException("ulType"); } return pacInfoBuffer; }