|
|
@@ -1,13 +1,13 @@
|
|
|
# gokrb5
|
|
|
-[](https://godoc.org/gopkg.in/jcmturner/gokrb5.v3) [](https://goreportcard.com/report/gopkg.in/jcmturner/gokrb5.v3) [](https://travis-ci.org/jcmturner/gokrb5)
|
|
|
+[](https://godoc.org/gopkg.in/jcmturner/gokrb5.v4) [](https://goreportcard.com/report/gopkg.in/jcmturner/gokrb5.v4) [](https://travis-ci.org/jcmturner/gokrb5)
|
|
|
|
|
|
To get the package, execute:
|
|
|
```
|
|
|
-go get gopkg.in/jcmturner/gokrb5.v3
|
|
|
+go get gopkg.in/jcmturner/gokrb5.v4
|
|
|
```
|
|
|
To import this package, add the following line to your code:
|
|
|
```go
|
|
|
-import "gopkg.in/jcmturner/gokrb5.v3/<sub package>"
|
|
|
+import "gopkg.in/jcmturner/gokrb5.v4/<sub package>"
|
|
|
|
|
|
```
|
|
|
|
|
|
@@ -51,7 +51,7 @@ Currently the following is working/tested:
|
|
|
The gokrb5 libraries use the same krb5.conf configuration file format as MIT Kerberos, described [here](https://web.mit.edu/kerberos/krb5-latest/doc/admin/conf_files/krb5_conf.html).
|
|
|
Config instances can be created by loading from a file path or by passing a string, io.Reader or bufio.Scanner to the relevant method:
|
|
|
```go
|
|
|
-import "gopkg.in/jcmturner/gokrb5.v3/config"
|
|
|
+import "gopkg.in/jcmturner/gokrb5.v4/config"
|
|
|
cfg, err := config.Load("/path/to/config/file")
|
|
|
cfg, err := config.NewConfigFromString(krb5Str) //String must have appropriate newline separations
|
|
|
cfg, err := config.NewConfigFromReader(reader)
|
|
|
@@ -60,7 +60,7 @@ cfg, err := config.NewConfigFromScanner(scanner)
|
|
|
### Keytab files
|
|
|
Standard keytab files can be read from a file or from a slice of bytes:
|
|
|
```go
|
|
|
-import "gopkg.in/jcmturner/gokrb5.v3/keytab"
|
|
|
+import "gopkg.in/jcmturner/gokrb5.v4/keytab"
|
|
|
ktFromFile, err := keytab.Load("/path/to/file.keytab")
|
|
|
ktFromBytes, err := keytab.Parse(b)
|
|
|
|
|
|
@@ -71,7 +71,7 @@ ktFromBytes, err := keytab.Parse(b)
|
|
|
### Kerberos Client
|
|
|
Create a client instance with either a password or a keytab:
|
|
|
```go
|
|
|
-import "gopkg.in/jcmturner/gokrb5.v3/client"
|
|
|
+import "gopkg.in/jcmturner/gokrb5.v4/client"
|
|
|
cl := client.NewClientWithPassword("username", "REALM.COM", "password")
|
|
|
cl := client.NewClientWithKeytab("username", "REALM.COM", kt)
|
|
|
|
|
|
@@ -186,7 +186,7 @@ if validuser, ok := ctx.Value(service.CTXKeyAuthenticated).(bool); ok && validus
|
|
|
#### Generic Kerberised Service - Validating Client Details
|
|
|
To validate the AP_REQ sent by the client on the service side call this method:
|
|
|
```go
|
|
|
-import "gopkg.in/jcmturner/gokrb5.v3/service"
|
|
|
+import "gopkg.in/jcmturner/gokrb5.v4/service"
|
|
|
if ok, creds, err := service.ValidateAPREQ(mt.APReq, kt, r.RemoteAddr); ok {
|
|
|
// Perform application specifc actions
|
|
|
// creds object has details about the client identity
|