Git Product home page Git Product logo

gopgkrb5's Introduction

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.

gopgkrb5's People

Contributors

otan avatar sireax avatar mre-fog avatar rafiss avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.