Merge branch 'master' of github.com:launchdarkly/go-ntlmssp

This commit is contained in:
Eli Bishop
2020-06-11 11:52:50 -07:00
5 changed files with 122 additions and 8 deletions

100
.circleci/config.yml Normal file
View File

@@ -0,0 +1,100 @@
version: 2.1
orbs:
win: circleci/windows@1.0.0
workflows:
workflow:
jobs:
- go-test:
name: Go 1.14
docker-image: circleci/golang:1.14
build-as-module: true
- go-test:
name: Go 1.13
docker-image: circleci/golang:1.13
build-as-module: true
- go-test:
name: Go 1.12
docker-image: circleci/golang:1.12
- go-test:
name: Go 1.11
docker-image: circleci/golang:1.11
- go-test:
name: Go 1.10
docker-image: circleci/golang:1.10
- go-test:
name: Go 1.9
docker-image: circleci/golang:1.9
- go-test:
name: Go 1.8
docker-image: circleci/golang:1.8
- go-test-windows:
name: Windows
jobs:
go-test:
parameters:
docker-image:
type: string
build-as-module:
type: boolean
default: false
docker:
- image: <<parameters.docker-image>>
environment:
CIRCLE_TEST_REPORTS: /tmp/circle-reports
CIRCLE_ARTIFACTS: /tmp/circle-artifacts
COMMON_GO_PACKAGES: >
github.com/jstemmer/go-junit-report
working_directory: /go/src/github.com/launchdarkly/go-ntlmssp
steps:
- checkout
- run: go get -u $COMMON_GO_PACKAGES
- unless:
condition: <<parameters.build-as-module>>
steps:
- run: go get -t .
- run:
name: Run tests
command: |
mkdir -p $CIRCLE_TEST_REPORTS
mkdir -p $CIRCLE_ARTIFACTS
trap "go-junit-report < $CIRCLE_ARTIFACTS/report.txt > $CIRCLE_TEST_REPORTS/junit.xml" EXIT
go test -v -race | tee $CIRCLE_ARTIFACTS/report.txt
- store_test_results:
path: /tmp/circle-reports
- store_artifacts:
path: /tmp/circle-artifacts
go-test-windows:
executor:
name: win/vs2019
shell: powershell.exe
environment:
GOPATH: C:\Users\VssAdministrator\go
PACKAGE_PATH: github.com/launchdarkly/go-ntlmssp
steps:
- checkout
- run: go version
- run:
name: move source
command: |
go env GOPATH
mkdir ${env:GOPATH}\src\${env:PACKAGE_PATH}
mv * ${env:GOPATH}\src\${env:PACKAGE_PATH}
- run:
name: build and test
command: |
cd ${env:GOPATH}\src\${env:PACKAGE_PATH}
go get -t .
go test -v -race ./...

View File

@@ -1,7 +1,9 @@
# go-ntlmssp
Golang package that provides NTLM/Negotiate authentication over HTTP
[![GoDoc](https://godoc.org/github.com/Azure/go-ntlmssp?status.svg)](https://godoc.org/github.com/Azure/go-ntlmssp) [![Build Status](https://travis-ci.org/Azure/go-ntlmssp.svg?branch=dev)](https://travis-ci.org/Azure/go-ntlmssp)
[![GoDoc](https://godoc.org/github.com/launchdarkly/go-ntlmssp?status.svg)](https://godoc.org/github.com/launchdarkly/go-ntlmssp) [![Circle CI](https://circleci.com/gh/launchdarkly/go-ntlmssp.svg?style=svg)](https://circleci.com/gh/launchdarkly/go-ntlmssp)
This is a fork of [github.com/Azure/go-ntlmssp](https://github.com/Azure/go-ntlmssp), with minor changes for use in the [LaunchDarkly Go SDK](https://github.com/launchdarkly/go-server-sdk).
Protocol details from https://msdn.microsoft.com/en-us/library/cc236621.aspx
Implementation hints from http://davenport.sourceforge.net/ntlm.html

5
go.mod Normal file
View File

@@ -0,0 +1,5 @@
module github.com/launchdarkly/go-ntlmssp
go 1.13
require golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9

7
go.sum Normal file
View File

@@ -0,0 +1,7 @@
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9 h1:vEg9joUBmeBcK9iSJftGNf3coIG4HqZElCPehJsfAYM=
golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

View File

@@ -25,21 +25,21 @@ func TestUsernameDomainWorkstation(t *testing.T) {
xb []byte
}{
{username, "", username, "", []byte{
0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x82,
0x88, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x28, 0x00, 0x00, 0x00, 0x06, 0x01, 0xb1, 0x1d, 0x00, 0x00, 0x00, 0x0f}},
{domain + "\\" + username, "", username, domain, []byte{
0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x10,
0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x92,
0x88, 0xa0, 0x08, 0x00, 0x08, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x30, 0x00, 0x00, 0x00, 0x06, 0x01, 0xb1, 0x1d, 0x00, 0x00, 0x00, 0x0f, 0x4d, 0x59,
0x44, 0x4f, 0x4d, 0x41, 0x49, 0x4e}},
{domain + "\\" + username, workstation, username, domain, []byte{
0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x30,
0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0xb2,
0x88, 0xa0, 0x08, 0x00, 0x08, 0x00, 0x28, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00,
0x30, 0x00, 0x00, 0x00, 0x06, 0x01, 0xb1, 0x1d, 0x00, 0x00, 0x00, 0x0f, 0x4d, 0x59,
0x44, 0x4f, 0x4d, 0x41, 0x49, 0x4e, 0x4d, 0x59, 0x50, 0x43}},
{username, workstation, username, "", []byte{
0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x20,
0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0xa2,
0x88, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00,
0x28, 0x00, 0x00, 0x00, 0x06, 0x01, 0xb1, 0x1d, 0x00, 0x00, 0x00, 0x0f, 0x4d, 0x59,
0x50, 0x43}},
@@ -48,10 +48,10 @@ func TestUsernameDomainWorkstation(t *testing.T) {
for _, table := range tables {
tuser, tdomain := GetDomain(table.u)
if tuser != table.xu {
t.Fatalf("username not correct, expected %v got %v", tuser, table.xu)
t.Fatalf("username not correct, expected %v got %v", table.xu, tuser)
}
if tdomain != table.xd {
t.Fatalf("domain not correct, expected %v got %v", tdomain, table.xd)
t.Fatalf("domain not correct, expected %v got %v", table.xd, tdomain)
}
tb, err := NewNegotiateMessage(tdomain, table.w)
@@ -60,7 +60,7 @@ func TestUsernameDomainWorkstation(t *testing.T) {
}
if !bytes.Equal(tb, table.xb) {
t.Fatalf("negotiate message bytes not correct, expected %v got %v", tb, table.xb)
t.Fatalf("negotiate message bytes not correct, expected %v got %v", table.xb, tb)
}
}