Skip to content
Snippets Groups Projects
Select Git revision
  • 6b724c8fce31d5e70eae4eacc1a7d32b3e73b6a7
  • noblogs default
  • noblogs-5.7.1
  • upstream
  • noblogs-5.7
  • noblogs-5.6new
  • upstream5.5.1
  • noblogs28dic
  • upstream28dic
  • noblogs-5.5.1
  • noblogs-5.4.2
  • noblogs-5.4_seconda
  • noblogs-5.4
  • noblogs-7c
  • wp5.2.3p3
  • mergedbconf
  • noblogs-5.7.1
  • noblogs.5.7.0p1
  • noblogs-5.7.0
  • noblogs-5.6p3
  • noblogs5.6p2
  • noblogs-5.6p1
  • noblogs-5.6
  • noblogs-5.4.2p1
  • noblogs-5.4.2
  • noblogs-5.4.1
  • noblogs-5.4
  • noblogs-p5.4
  • noblogs-5.3.2p2
  • noblogs-5.3.2p1
  • noblogs-5.3.2
  • noblogs-5.3
  • noblogs-5.2.3p4
  • noblogs-5.2.3p3
  • noblogs-5.2.3p2
  • noblogs-5.2.3p1
36 results

image-edit.js

  • authheader.go 746 B
    package ntlmssp
    
    import (
    	"encoding/base64"
    	"strings"
    )
    
    type authheader string
    
    func (h authheader) IsBasic() bool {
    	return strings.HasPrefix(string(h), "Basic ")
    }
    
    func (h authheader) IsNegotiate() bool {
    	return strings.HasPrefix(string(h), "Negotiate")
    }
    
    func (h authheader) IsNTLM() bool {
    	return strings.HasPrefix(string(h), "NTLM")
    }
    
    func (h authheader) GetData() ([]byte, error) {
    	p := strings.Split(string(h), " ")
    	if len(p) < 2 {
    		return nil, nil
    	}
    	return base64.StdEncoding.DecodeString(string(p[1]))
    }
    
    func (h authheader) GetBasicCreds() (username, password string, err error) {
    	d, err := h.GetData()
    	if err != nil {
    		return "", "", err
    	}
    	parts := strings.SplitN(string(d), ":", 2)
    	return parts[0], parts[1], nil
    }