Skip to content
/ gopgkrb5 Public

Adds the dependencies necessary for Go PG drivers to access krb5.

License

Notifications You must be signed in to change notification settings

otan/gopgkrb5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gopgkrb5

Adds the dependencies necessary for Go PG drivers to access krb5.

It is a separate repository for reducing dependencies and is heavily inherited from the lib/pq library.

Usage with jackc/pgconn and friends

Add the library:

go get github.com/otan/gopgkrb5

and initialise the package and import the package into pgconn:

import (
 "github.com/jackc/pgconn"
 "github.com/otan/gopgkrb5"
)

func init() {
  pgconn.RegisterGSSProvider(func() (pgconn.GSS, error) { return gopgkrb5.NewGSS() })
}

Unix only features

Optional settings are available:

import (
 "github.com/jcmturner/gokrb5/v8/client"
 "github.com/jackc/pgconn"
 "github.com/otan/gopgkrb5"
)

func init() {
  pgconn.RegisterGSSProvider(func() (pgconn.GSS, error) { return gopgkrb5.NewGSS(client.NewSettings(...)) })
}

You can also use keytab to log in:

func init() {
  pgconn.RegisterGSSProvider(func() (pgconn.GSS, error) {
	  return gopgkrb5.NewGSSWithKeytab("username", "DOMAIN.LOCAL", "/test.keytab")
  })
}

or password:

func init() {
  pgconn.RegisterGSSProvider(func() (pgconn.GSS, error) {
	  return gopgkrb5.NewGSSWithPassword("username", "DOMAIN.LOCAL", "password")
  })
}

All dependencies of jackc/pgconn, e.g. jackc/pgx will now be able to authenticate with GSSAPI/krb5.

About

Adds the dependencies necessary for Go PG drivers to access krb5.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages