Пример #1
0
        private static bool ParsedNonGssApiToken(ReadOnlyMemory <byte> data, out ContextToken token)
        {
            //
            // A caller may try and pass a token that isn't wrapped by GSS-API semantics
            // We should try and detect what it is and return that instead of treating
            // it like GSS data
            //
            // We'll check if it's NTLM, NegoEx, or Kerberos
            // Otherwise bail and try letting GssApiToken sort it out
            //

            // are we an NTLM token?

            if (NtlmMessage.CanReadNtlmMessage(data))
            {
                token = new NtlmContextToken(data: data);
                return(true);
            }

            // are we a NegoEx token?

            if (NegotiateExtension.CanDecode(data))
            {
                token = new NegoExContextToken(data);
                return(true);
            }

            // are we a Kerberos ticket?

            if (KrbApChoice.CanDecode(data))
            {
                token = new KerberosContextToken(data: data);
                return(true);
            }

            // we don't know what we are. Maybe we're GSS so figure it out later.

            token = null;

            return(false);
        }
Пример #2
0
 public NegoExContextToken(ReadOnlyMemory <byte> data)
 {
     Token = new NegotiateExtension(data);
 }