Documentation ¶
Overview ¶
Package rules maintains established validation for shared aspects relating to either Jacamar specifically or the ECP CI effort as a whole. All checks that have been defined realize the validator.Func interface for the github.com/go-playground/validator/v10 and are meant to be a component in any validation strategy.
Example code:
type Header struct { Alg string `json:"alg" validate:"len=5,alphanum"` Kid string `json:"kid" validate:"kid"` Typ string `json:"typ" validate:"eq=JWT"` } func Assert(h Header) error { v := validator.New() _ = v.RegisterValidation("kid", rules.CheckKID) return v.Struct(h) }
Index ¶
- func CheckAuthToken(v validator.FieldLevel) bool
- func CheckDirectory(v validator.FieldLevel) bool
- func CheckGitLabToken(v validator.FieldLevel) bool
- func CheckJWT(v validator.FieldLevel) bool
- func CheckKID(v validator.FieldLevel) bool
- func CheckProjectPath(v validator.FieldLevel) bool
- func CheckSHA256(v validator.FieldLevel) bool
- func CheckSubject(v validator.FieldLevel) bool
- func CheckUsername(v validator.FieldLevel) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckAuthToken ¶
func CheckAuthToken(v validator.FieldLevel) bool
CheckAuthToken ensures a valid authorization token for federation supplied, an authorization is not required. Implements validator.Func.
func CheckDirectory ¶ added in v0.7.0
func CheckDirectory(v validator.FieldLevel) bool
CheckDirectory verifies the validity of an expected Unix path without checking for it's existence on the system.
func CheckGitLabToken ¶
func CheckGitLabToken(v validator.FieldLevel) bool
CheckGitLabToken ensures a valid GitLab job/personal/deploy token, implements validator.Func.
func CheckJWT ¶ added in v0.4.1
func CheckJWT(v validator.FieldLevel) bool
CheckJWT provide basic sanity check of characters found in a valid JSON Web Token, implements validator.Func.
func CheckKID ¶
func CheckKID(v validator.FieldLevel) bool
CheckKID ensures a valid Key ID in a JWT header, implement validator.Func.
func CheckProjectPath ¶
func CheckProjectPath(v validator.FieldLevel) bool
CheckProjectPath ensures the values adheres to expectations of a GitLab group/project., implements validator.Func. Path can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'.
func CheckSHA256 ¶
func CheckSHA256(v validator.FieldLevel) bool
CheckSHA256 ensures the string matches the structure of a SHA256 checksum, implements validator.Func.
func CheckSubject ¶
func CheckSubject(v validator.FieldLevel) bool
CheckSubject ensures the subject (sub) of a GitLab job jwt is valid, implements validator.Func.
func CheckUsername ¶
func CheckUsername(v validator.FieldLevel) bool
CheckUsername examines the provided username for validity based upon adduser(8). A username is treated as optional. Implements validator.Func.
Types ¶
This section is empty.