Skip to content

Commit 50be238

Browse files
jake-scottjake-desco
authored andcommitted
README / examples fixes
1 parent b29d2b0 commit 50be238

File tree

5 files changed

+64
-24
lines changed

5 files changed

+64
-24
lines changed

README.md

Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,53 @@
11
# GSSAPI interace for Go
22

3-
Upto this point there have been several GSSAPI implementations for Go,
4-
either native or C bindings. Developers needed to make a choice
5-
of implementation because their interfaces were not unified. This
6-
contrasts to the C language, where the bindings are specified
7-
[in RFC 2744](https://datatracker.ietf.org/doc/html/rfc2744).
3+
go-gssapi provides GSSAPI bindings for Go.
84

9-
The interface specified in this package aims to fill that gap, albeit
10-
without an RFC. The aim is to provide developers with a common, idomatic
11-
programming interface, allowing users to switch out the actual implementation
12-
depending on preference or local policy.
5+
![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/golang-auth/go-gssapi)
6+
[![Git Workflow](https://img.shields.io/github/actions/workflow/status/golang-auth/go-gssapi/checks.yml?branch=dev
7+
)](https://img.shields.io/github/actions/workflow/status/golang-auth/go-gssapi/checks.yml?branch=de)
8+
[![Go Version](https://img.shields.io/badge/go%20version-%3E=1.18-61CFDD.svg?style=flat-square)](https://golang.org/)
9+
[![GO Reference](https://pkg.go.dev/badge/mod/github.com/golang-auth/go-gssapi)](https://pkg.go.dev/mod/github.com/golang-auth/go-gssapi/v3)
1310

11+
# Overview
12+
This repository contains the Golang GSSAPI bindings interface and
13+
provider-independent support functions [described in the wiki](https://github.com/golang-auth/go-gssapi/wiki/Golang-GSSAPI-bindings-specification). A GSSAPI
14+
provider that implements the interface is required along with this package.
15+
16+
Versions prior to v3 of this repository contained a GSSAPI implementation that
17+
used native Golang Kerberos and was not pluggable. As of version 3, the
18+
providers are separate to the interface.
19+
20+
At this time, a provider that [wraps the C bindings](https://github.com/golang-auth/go-gssapi-c) is available. We feel that the native Go Kerberos implementation needs a reasonable amount of work for it to be production ready and so a native provider will come at a later stage. Developers are recommended to use the C wrappers
21+
at this stage.
22+
23+
## Installation
24+
25+
Include the interface and common functions from this package:
26+
27+
```go
28+
go get github.com/golang-auth/go-gssapi/v3
29+
```
30+
31+
.. and a provider, for example `go-gssapi-c`:
32+
```go
33+
go get github.com/golang-auth/go-gssapi-c
34+
```
35+
36+
## Getting started
37+
38+
The interface and provider packages should be included in the application. The
39+
provider package does not need to supply any symbols to the app -- just loading
40+
it is enough to have it register itself:
41+
42+
```go
43+
package main
44+
45+
import (
46+
_ "github.com/golang-auth/go-gssapi-c"
47+
"github.com/golang-auth/go-gssapi/v3"
48+
)
49+
50+
// GSSAPI-C is the name that go-gssapi-c registers itself under
51+
var gss = gssapi.NewProvider("GSSAPI-C")
52+
```
1453

examples/go/go.mod

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ go 1.22.4
44

55
replace github.com/golang-auth/go-gssapi/v3 => ../../v3
66

7-
replace github.com/golang-auth/go-gssapi-c => ../../../go-gssapi-c
7+
require github.com/golang-auth/go-gssapi/v3 v3.0.0-alpha
88

9-
require (
10-
github.com/golang-auth/go-gssapi-c v0.0.0-00010101000000-000000000000
11-
github.com/golang-auth/go-gssapi/v3 v3.0.0-00010101000000-000000000000
12-
)
9+
require github.com/golang-auth/go-gssapi-c v0.0.0-20240828194135-955ba90d4511

examples/go/go.sum

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
2-
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
2+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3+
github.com/golang-auth/go-gssapi-c v0.0.0-20240827133603-e7af9f04586a h1:qdMspd9EVKyHD4PqzYpCDpWaBwdm4oBY1u631biS/3U=
4+
github.com/golang-auth/go-gssapi-c v0.0.0-20240827133603-e7af9f04586a/go.mod h1:7+YbBfLmM3gMF6DoCfjZFQBx1SXj1Uru6Y2tl77nhJ8=
5+
github.com/golang-auth/go-gssapi-c v0.0.0-20240828194135-955ba90d4511 h1:k9cgAxS+AYKwAN7/moi03LK3EjTFUKeMRh9Cu2j4/D0=
6+
github.com/golang-auth/go-gssapi-c v0.0.0-20240828194135-955ba90d4511/go.mod h1:rb9NLAgRMfr732Kvm1mOH5J6eIx/WULl8rAFNXSzGqY=
37
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
48
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
5-
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
6-
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
7-
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
8-
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
9+
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
10+
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
11+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
12+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

examples/go/gss-client/gss-client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func main() {
147147
}
148148

149149
// Wrap the message
150-
outMsg, hasConf, err := secctx.Wrap(msgBuf, *confReq)
150+
outMsg, hasConf, err := secctx.Wrap(msgBuf, *confReq, 0)
151151
if err != nil {
152152
log.Fatal(err)
153153
}
@@ -168,7 +168,7 @@ func main() {
168168
}
169169
debug("Received MIC message (%d bytes):\n%s", len(msgMIC), formatToken(msgMIC))
170170

171-
if err = secctx.VerifyMIC(msgBuf, msgMIC); err != nil {
171+
if _, err = secctx.VerifyMIC(msgBuf, msgMIC); err != nil {
172172
log.Fatal(err)
173173
}
174174

examples/go/gss-server/gss-server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func handleConn(conn net.Conn) error {
162162
}
163163
debug("Received wrap message (%d bytes):\n%s", len(inMsg), formatToken(inMsg))
164164

165-
origMsg, conf, err := secctx.Unwrap(inMsg)
165+
origMsg, conf, _, err := secctx.Unwrap(inMsg)
166166
if err != nil {
167167
return showErr(err)
168168
}
@@ -174,7 +174,7 @@ func handleConn(conn net.Conn) error {
174174
fmt.Printf(`Received %s message: "%s"`+"\n", protStr, origMsg)
175175

176176
// generate a MIC token to send back
177-
if outToken, err = secctx.GetMIC(origMsg); err != nil {
177+
if outToken, err = secctx.GetMIC(origMsg, 0); err != nil {
178178
return showErr(err)
179179
}
180180

0 commit comments

Comments
 (0)