Esempio n. 1
0
        public void SPNegoInitTokenRoundtrip()
        {
            NegotiationToken negToken = new NegotiationToken
            {
                InitialToken = new NegTokenInit
                {
                    MechTypes = new Oid[] { new Oid(MechType.NTLM) },
                    MechToken = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 }
                }
            };

            var encoded = negToken.Encode();

            var decoded = NegotiationToken.Decode(encoded);

            Assert.IsNotNull(decoded);
            Assert.IsNotNull(decoded.InitialToken);
            Assert.IsNull(decoded.ResponseToken);
        }
Esempio n. 2
0
        public void ChoiceEncoding()
        {
            NegotiationToken negToken = new NegotiationToken
            {
                InitialToken = new NegTokenInit
                {
                    MechTypes = new Oid[] { new Oid(MechType.NTLM) },
                    MechToken = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 }
                },
                ResponseToken = new NegTokenResp
                {
                    State         = NegotiateState.Rejected,
                    SupportedMech = new Oid(MechType.NTLM),
                    ResponseToken = new byte[] { 7, 6, 5, 4, 3, 2, 1, 0 }
                }
            };

            negToken.Encode();
        }
Esempio n. 3
0
        public void SPNegoResponseTokenRoundtrip()
        {
            NegotiationToken negToken = new NegotiationToken
            {
                ResponseToken = new NegTokenResp
                {
                    State         = NegotiateState.Rejected,
                    SupportedMech = new Oid(MechType.NTLM),
                    ResponseToken = new byte[] { 7, 6, 5, 4, 3, 2, 1, 0 }
                }
            };

            var encoded = negToken.Encode();

            var decoded = NegotiationToken.Decode(encoded);

            Assert.IsNotNull(decoded);
            Assert.IsNull(decoded.InitialToken);
            Assert.IsNotNull(decoded.ResponseToken);
        }