auth

package
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Overview

Package auth defines the interface and the GRPC implementation for authentication plugins. Authentication plugins allow to authenticate external users

Index

Constants

View Source
const (
	// PluginName defines the name for a notifier plugin
	PluginName = "auth"
)

Variables

View Source
var Handshake = plugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   "SFTPGO_PLUGIN_AUTH",
	MagicCookieValue: "d1ed507d-d2be-4a38-a460-6fe0b2cc7efc",
}

Handshake is a common handshake that is shared by plugin and host.

View Source
var PluginMap = map[string]plugin.Plugin{
	PluginName: &Plugin{},
}

PluginMap is the map of plugins we can dispense.

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	CheckUserAndPass(username, password, ip, protocol string, userAsJSON []byte) ([]byte, error)
	CheckUserAndTLSCert(username, tlsCert, ip, protocol string, userAsJSON []byte) ([]byte, error)
	CheckUserAndPublicKey(username, pubKey, ip, protocol string, userAsJSON []byte) ([]byte, error)
	CheckUserAndKeyboardInteractive(username, ip, protocol string, userAsJSON []byte) ([]byte, error)
	SendKeyboardAuthRequest(requestID, username, password, ip string, answers, questions []string, step int32) (string, []string, []bool, int, int, error)
}

Authenticator defines the interface for authentication plugins

type GRPCClient

type GRPCClient struct {
	// contains filtered or unexported fields
}

GRPCClient is an implementation of Authenticator interface that talks over RPC.

func (*GRPCClient) CheckUserAndKeyboardInteractive

func (c *GRPCClient) CheckUserAndKeyboardInteractive(username, ip, protocol string, userAsJSON []byte) ([]byte, error)

CheckUserAndKeyboardInteractive implements the Authenticator interface

func (*GRPCClient) CheckUserAndPass

func (c *GRPCClient) CheckUserAndPass(username, password, ip, protocol string, userAsJSON []byte) ([]byte, error)

CheckUserAndPass implements the Authenticator interface

func (*GRPCClient) CheckUserAndPublicKey

func (c *GRPCClient) CheckUserAndPublicKey(username, pubKey, ip, protocol string, userAsJSON []byte) ([]byte, error)

CheckUserAndPublicKey implements the Authenticator interface

func (*GRPCClient) CheckUserAndTLSCert

func (c *GRPCClient) CheckUserAndTLSCert(username, tlsCert, ip, protocol string, userAsJSON []byte) ([]byte, error)

CheckUserAndTLSCert implements the Authenticator interface

func (*GRPCClient) SendKeyboardAuthRequest

func (c *GRPCClient) SendKeyboardAuthRequest(requestID, username, password, ip string, answers, questions []string, step int32) (string, []string, []bool, int, int, error)

SendKeyboardAuthRequest implements the Authenticator interface

type GRPCServer

type GRPCServer struct {
	Impl Authenticator
}

GRPCServer defines the gRPC server that GRPCClient talks to.

func (*GRPCServer) CheckUserAndKeyboardInteractive

func (s *GRPCServer) CheckUserAndKeyboardInteractive(ctx context.Context, req *proto.CheckUserAndKeyboardInteractiveRequest) (*proto.AuthResponse, error)

CheckUserAndKeyboardInteractive implements the server side check user and keyboard interactive method

func (*GRPCServer) CheckUserAndPass

func (s *GRPCServer) CheckUserAndPass(ctx context.Context, req *proto.CheckUserAndPassRequest) (*proto.AuthResponse, error)

CheckUserAndPass implements the server side check user and password method

func (*GRPCServer) CheckUserAndPublicKey

func (s *GRPCServer) CheckUserAndPublicKey(ctx context.Context, req *proto.CheckUserAndPublicKeyRequest) (*proto.AuthResponse, error)

CheckUserAndPublicKey implements the server side check user and public key method

func (*GRPCServer) CheckUserAndTLSCert

func (s *GRPCServer) CheckUserAndTLSCert(ctx context.Context, req *proto.CheckUserAndTLSCertRequest) (*proto.AuthResponse, error)

CheckUserAndTLSCert implements the server side check user and tls certificate method

func (*GRPCServer) SendKeyboardAuthRequest

func (s *GRPCServer) SendKeyboardAuthRequest(ctx context.Context, req *proto.KeyboardAuthRequest) (*proto.KeyboardAuthResponse, error)

SendKeyboardAuthRequest implements the server side method to send a keyboard interactive authentication request

type Plugin

type Plugin struct {
	plugin.Plugin
	Impl Authenticator
}

Plugin defines the implementation to serve/connect to an authe plugin

func (*Plugin) GRPCClient

func (p *Plugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

GRPCClient defines the GRPC client implementation for this plugin

func (*Plugin) GRPCServer

func (p *Plugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

GRPCServer defines the GRPC server implementation for this plugin

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL