Files
nats-server/server/auth.go
Christophe de Vienne f94983a9a4 Add TLS infos to ClientAuth interface
It makes it possible to implement a Auth that uses client TLS certificates
to identify them.
2016-12-21 10:31:22 +01:00

24 lines
566 B
Go

// Copyright 2012-2014 Apcera Inc. All rights reserved.
package server
import (
"crypto/tls"
)
// Auth is an interface for implementing authentication
type Auth interface {
// Check if a client is authorized to connect
Check(c ClientAuth) bool
}
// ClientAuth is an interface for client authentication
type ClientAuth interface {
// Get options associated with a client
GetOpts() *clientOpts
// If TLS is enabled, TLS ConnectionState, nil otherwise
GetTLSConnectionState() *tls.ConnectionState
// Optionally map a user after auth.
RegisterUser(*User)
}