You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

49 lines
1.3 KiB

package core
import (
"golang.org/x/crypto/ssh"
"maze.io/gate/pkg/core/logger"
"maze.io/gate/pkg/util/compact"
)
// IdentityProvider provides user and groups.
type IdentityProvider interface {
// Setup the IDP with a logger.
Setup(logger *logger.Logger) error
// LookupUser resolves a user by login name.
LookupUser(name string) (User, error)
// LookupGroup resolves a group by name.
LookupGroup(name string) (Group, error)
// PasswordCallback, if non-nil, is called when a obj attempts to authenticate using a password.
PasswordCallback(conn ssh.ConnMetadata, password []byte) (*ssh.Permissions, error)
// PublicKeyCallback, if non-nil, is called when a client
// offers a public key for authentication. It must return a nil error
// if the given public key can be used to authenticate the
// given obj. For example, see CertChecker.Authenticate. A
// call to this function does not guarantee that the key
// offered is in fact used to authenticate. To record any data
// depending on the public key, store it inside a
// Permissions.Extensions entry.
PublicKeyCallback(conn ssh.ConnMetadata, key ssh.PublicKey) (*ssh.Permissions, error)
}
// User entity.
type User interface {
ID() compact.ID
Login() string
Name() string
Groups() []Group
}
// Group entity.
type Group interface {
ID() compact.ID
Name() string
Members() []User
}