krb.go 815 B

12345678910111213141516171819202122232425262728
  1. package pq
  2. // NewGSSFunc creates a GSS authentication provider, for use with
  3. // RegisterGSSProvider.
  4. type NewGSSFunc func() (GSS, error)
  5. var newGss NewGSSFunc
  6. // RegisterGSSProvider registers a GSS authentication provider. For example, if
  7. // you need to use Kerberos to authenticate with your server, add this to your
  8. // main package:
  9. //
  10. // import "github.com/lib/pq/auth/kerberos"
  11. //
  12. // func init() {
  13. // pq.RegisterGSSProvider(func() (pq.GSS, error) { return kerberos.NewGSS() })
  14. // }
  15. func RegisterGSSProvider(newGssArg NewGSSFunc) {
  16. newGss = newGssArg
  17. }
  18. // GSS provides GSSAPI authentication (e.g., Kerberos).
  19. type GSS interface {
  20. GetInitToken(host string, service string) ([]byte, error)
  21. GetInitTokenFromSpn(spn string) ([]byte, error)
  22. Continue(inToken []byte) (done bool, outToken []byte, err error)
  23. }