auth

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2018 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DaemonGithubKeyLocation is the default path of the deploy key
	DaemonGithubKeyLocation = "/app/host/.ssh/id_rsa_inertia_deploy"
)
View Source
const UserDatabasePath = "/app/host/.inertia/users.db"

UserDatabasePath is the default location for storing users.

Variables

This section is empty.

Functions

func GenerateCertificate

func GenerateCertificate(certPath, keyPath, host, method string) error

GenerateCertificate creates an SSL certificate for HTTPS use

func GenerateToken

func GenerateToken(key []byte) (string, error)

GenerateToken creates a JSON Web Token (JWT) for a client to use when sending HTTP requests to the daemon server.

func GetAPIPrivateKey

func GetAPIPrivateKey(t *jwt.Token) (interface{}, error)

GetAPIPrivateKey returns the private RSA key to authenticate HTTP requests sent to the daemon. For now, we simply use the GitHub deploy key. Retrieves from default DaemonGithubKeyLocation.

func GetGithubKey

func GetGithubKey(pemFile io.Reader) (ssh.AuthMethod, error)

GetGithubKey returns an ssh.AuthMethod from the given io.Reader for use with the go-git library

func GitAuthFailedErr

func GitAuthFailedErr(path ...string) error

GitAuthFailedErr attaches the daemon key in the error message

Types

type PermissionsHandler added in v0.3.0

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

PermissionsHandler handles users, permissions, and sessions on top of an http.ServeMux. It is used for Inertia Web.

func NewPermissionsHandler added in v0.3.0

func NewPermissionsHandler(
	dbPath, hostDomain string, timeout int,
	keyLookup ...func(*jwt.Token) (interface{}, error),
) (*PermissionsHandler, error)

NewPermissionsHandler returns a new handler for authenticating users and handling user administration. Param userlandPath is used to set cookie domain.

func (*PermissionsHandler) AttachAdminRestrictedHandlerFunc added in v0.3.0

func (h *PermissionsHandler) AttachAdminRestrictedHandlerFunc(path string, handler http.HandlerFunc)

AttachAdminRestrictedHandlerFunc attaches and restricts given path and handler to logged in admins.

func (*PermissionsHandler) AttachPublicHandler added in v0.3.0

func (h *PermissionsHandler) AttachPublicHandler(path string, handler http.Handler)

AttachPublicHandler attaches given path and handler and makes it publicly available

func (*PermissionsHandler) AttachPublicHandlerFunc added in v0.3.0

func (h *PermissionsHandler) AttachPublicHandlerFunc(path string, handler http.HandlerFunc)

AttachPublicHandlerFunc attaches given path and handler and makes it publicly available

func (*PermissionsHandler) AttachUserRestrictedHandlerFunc added in v0.3.0

func (h *PermissionsHandler) AttachUserRestrictedHandlerFunc(path string, handler http.HandlerFunc)

AttachUserRestrictedHandlerFunc attaches and restricts given path and handler to logged in users.

func (*PermissionsHandler) Close added in v0.3.0

func (h *PermissionsHandler) Close() error

Close releases resources held by the PermissionsHandler

func (*PermissionsHandler) ServeHTTP added in v0.3.0

func (h *PermissionsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

nolint: gocyclo

Jump to

Keyboard shortcuts

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