Documentation ¶
Index ¶
Constants ¶
const CertFileExt = ".crt"
const IssuerCertFileExt = ".issuer.crt"
const KeyFileExt = ".key"
const PemFileExt = ".pem"
Variables ¶
var ( // ErrMissingID is returned when you made a call that isn't supported // without an ID in the URI ErrMissingID = errors.New("Missing identifier in URI") // 400 // ErrMismatchedID is returned when the post body doesn't match the URI ErrMismatchedID = errors.New("URI doesn't match provided data") // 400 // ErrBodyRequired is returned if a request did not contain a body when one // was needed. ErrBodyRequired = errors.New("Body is required for this endpoint") // 400 )
var ( ErrInvalidAuthEmail = errors.New("auth email cannot be blank") ErrInvalidAuthKey = errors.New("auth key cannot be blank") )
var ( // ErrInvalidUserName gives info to what a valid username should look like. ErrInvalidUserName = errors.New("User's Names must only be alphanumeric or include -, @, ., + and be up to 32 characters in length") // ErrInvalidUserPassword shows what a valid password should consist of. ErrInvalidUserPassword = errors.New("Password must be at least 6 characters long and not include whitespace") // ErrInvalidUserRole simply tells whether a role exists or not. ErrInvalidUserRole = errors.New("Role does not exist") )
var ErrAuthFailed = errors.New("failed to authenticate")
ErrAuthFailed is for authentication failures of most types
var ErrAuthInvalidCreds = errors.New("invalid credentials")
ErrAuthInvalidCreds means your credentials were not parsed properly or did not match.
Functions ¶
This section is empty.
Types ¶
type AuthHandler ¶
type AuthHandler interface {
Authenticate() http.HandlerFunc
}
AuthHandler provides an interface for all calls to the api/authenticate endpoints.
func NewAuthHandler ¶
func NewAuthHandler(cs config.Service, us user.Service) AuthHandler
NewAuthHandler returns a instantiated AuthHandler for use in a router.
type CertResp ¶
type CertResp struct { ID string Secret string CommonName string Domains []string CertURL string CertStableURL string Expiry time.Time RenewAt int Issued bool LastError string ACMEEmail string ModTime time.Time }
CertResp is used for exporting User data via API responses
type CertificateHandler ¶
type CertificateHandler interface { GetAll() http.HandlerFunc Get() http.HandlerFunc Post() http.HandlerFunc Delete() http.HandlerFunc DeleteAll() http.HandlerFunc GetCert() http.HandlerFunc GetPrivkey() http.HandlerFunc GetIssuer() http.HandlerFunc Renew() http.HandlerFunc }
func NewCertificateHandler ¶
func NewCertificateHandler(cs certificate.Service, as acme.Service) CertificateHandler
type ChallengeHandler ¶
type ChallengeHandler interface { Get() http.HandlerFunc Put() http.HandlerFunc }
ChallengeHandler provides endpoints for all api/config/ calls. TODO: Change this to a "Handle" func only, abstract from there.
func NewChallengeHandler ¶
func NewChallengeHandler(cs challenge_config.Service) ChallengeHandler
NewChallengeHandler takes a config.Service and returns a working ConfigHandler.
type ConfigHandler ¶
type ConfigHandler interface {
SuperAdmin() http.HandlerFunc
}
ConfigHandler provides endpoints for all api/config/ calls. TODO: Add RESET for JWT secret. TODO: Change this to a "Handle" func only, abstract from there.
func NewConfigHandler ¶
func NewConfigHandler(cs config.Service) ConfigHandler
NewConfigHandler takes a config.Service and returns a working ConfigHandler.
type Handler ¶
type Handler interface { Status() http.HandlerFunc Route() *mux.Router }
Handler provides an interface for all api/calls.
func NewHandler ¶
func NewHandler(version string, us user.Service, cs config.Service, chs challenge_config.Service, crs certificate.Service, as acme.Service) Handler
NewHandler creates a new apiHandler with given UserService and ConfigService.
type MiddlewareHandler ¶
type MiddlewareHandler interface {
Permission(rbac.Permission, http.HandlerFunc) http.HandlerFunc
}
func NewMiddlewareHandler ¶
func NewMiddlewareHandler(cs config.Service, r *rbac.RBAC) MiddlewareHandler
type UserHandler ¶
type UserHandler interface { GetAll() http.HandlerFunc Get() http.HandlerFunc Put() http.HandlerFunc Delete() http.HandlerFunc DeleteAll() http.HandlerFunc }
func NewUserHandler ¶
func NewUserHandler(us user.Service) UserHandler