public InitialNegToken2( MechType spnegoMech, NegotiationToken2 negToken) { this.spnegoMech = spnegoMech; this.negToken = negToken; }
public InitialNegToken2( MechType spnegoMech, NegotiationToken2 negToken) { this.spnegoMech = spnegoMech; this.negToken = negToken; }
public NegTokenResp( NegState negState, MechType supportedMech, Asn1OctetString responseToken, Asn1OctetString mechListMIC) { this.negState = negState; this.supportedMech = supportedMech; this.responseToken = responseToken; this.mechListMIC = mechListMIC; }
public NegTokenResp( NegState negState, MechType supportedMech, Asn1OctetString responseToken, Asn1OctetString mechListMIC) { this.negState = negState; this.supportedMech = supportedMech; this.responseToken = responseToken; this.mechListMIC = mechListMIC; }
/// <summary> /// Initialize the securityMechContext based on the security package type /// </summary> /// <param name="mechType">security mechanism type</param> /// <param name="inToken">the input security token</param> /// <exception cref="InvalidOperationException">Thrown if could not find the configuration.</exception> /// <exception cref="InvalidOperationException">Thrown when security configuration is unknown</exception> private void InitializeSecurityContext(MechType mechType, byte[] inToken) { SpngClientContext clientContext = this.client.Context as SpngClientContext; SecurityPackageType authType = SpngUtility.ConvertMechType(mechType); CurrentSecurityConfig = SpngUtility.GetSecurityConfig(this.securityConfigList, authType); if (CurrentSecurityConfig == null) { throw new InvalidOperationException("Missing configuration for " + authType.ToString()); } if (securityMechContext != null) { // re-enter. Nothing need to do return; } if (CurrentSecurityConfig.GetType() == typeof(KerberosClientSecurityConfig)) { KerberosClientSecurityConfig kileConfig = CurrentSecurityConfig as KerberosClientSecurityConfig; securityMechContext = new KerberosClientSecurityContext( kileConfig.ServiceName, kileConfig.ClientCredential, KerberosAccountType.User, kileConfig.KdcIpAddress, kileConfig.KdcPort, kileConfig.TransportType, kileConfig.SecurityAttributes); } else if (CurrentSecurityConfig.GetType() == typeof(NlmpClientSecurityConfig)) { NlmpClientSecurityConfig nlmpConfig = CurrentSecurityConfig as NlmpClientSecurityConfig; NlmpClientCredential cred = new NlmpClientCredential( nlmpConfig.TargetName, nlmpConfig.DomainName, nlmpConfig.AccountName, nlmpConfig.Password); securityMechContext = new NlmpClientSecurityContext(cred, nlmpConfig.SecurityAttributes); } else if (CurrentSecurityConfig.GetType() == typeof(SspiClientSecurityConfig)) { throw new InvalidOperationException("Only support Kerberos security config and NTLM security config"); } else { throw new InvalidOperationException("unknown security config"); } }
/// <summary> /// Generate the default supported MechType list /// </summary> /// <returns>DefaultMechList</returns> public static MechTypeList GenerateDefaultMechList() { MechType unknownMechType = new MechType(SspiLib.Consts.UnknownOidInt); MechType msKerbMechType = new MechType(SspiLib.Consts.MsKerbOidInt); MechType kerbMechType = new MechType(SspiLib.Consts.KerbOidInt); MechType nlmpMechType = new MechType(SspiLib.Consts.NlmpOidInt); MechType negoExMechType = new MechType(SspiLib.Consts.NegoExOidInt); MechTypeList mechList = new MechTypeList(new MechType[] { nlmpMechType, msKerbMechType, negoExMechType, kerbMechType, unknownMechType }); return(mechList); }
/// <summary> /// Adjust the sequence of a MechType list /// </summary> /// <param name="mechList">the MechType list</param> /// <param name="indexToMove">the MechType with this index will be moved to first</param> /// <returns>The updated MechType list</returns> /// <exception cref="ArgumentOutOfRangeException">index out of range</exception> public static MechTypeList MoveMechTypeToFirst(MechTypeList mechList, int indexToMove) { if (indexToMove >= mechList.Elements.Length) { throw new System.ArgumentOutOfRangeException("indexToMove"); } MechType mechTypeToMove = mechList.Elements[indexToMove]; for (int i = indexToMove; i > 0; i--) { //swap i with i-1 MechType currentMechType = mechList.Elements[i - 1]; mechList.Elements[i - 1] = mechList.Elements[i]; mechList.Elements[i] = currentMechType; } return(mechList); }
/// <summary> /// Convert MechType to SecurityPackage enum /// </summary> /// <param name="mechType">The MechType value to be convert</param> /// <returns>The converted AuthMech enum value</returns> public static SecurityPackageType ConvertMechType(MechType mechType) { SecurityPackageType authType = SecurityPackageType.Unknown; if (ArrayUtility.CompareArrays <int>(mechType.Value, SspiLib.Consts.MsKerbOidInt)) { authType = SecurityPackageType.Kerberos; } else if (ArrayUtility.CompareArrays <int>(mechType.Value, SspiLib.Consts.NlmpOidInt)) { authType = SecurityPackageType.Ntlm; } else if (ArrayUtility.CompareArrays <int>(mechType.Value, SspiLib.Consts.KerbOidInt)) { authType = SecurityPackageType.Kerberos; } else if (ArrayUtility.CompareArrays <int>(mechType.Value, SspiLib.Consts.NegoExOidInt)) { authType = SecurityPackageType.Unknown; } return(authType); }
public SavedMechTypeList(MechType[] val) : base(val) { }