Documentation
¶
Index ¶
- Constants
- Variables
- func GenerateCookie() (*http.Cookie, error)
- func GetCorsDisablingHandler(next http.Handler) http.Handler
- func GetErrMsg(actualStatusCode int, respBodyMsg string) string
- func GetTimeIn30Days() time.Time
- func Hash(clearText string) (string, error)
- func SaltAndHash(clearText string) (string, error)
- func SendJsonResponse(w http.ResponseWriter, data interface{})
- func SetCookieAndOriginHeaders(req *http.Request, c *ComponentClient)
- func UnpackResponse[T any](object interface{}) (*T, error)
- func ZipDirectoryToBytes(dirPath string) ([]byte, error)
- type ChangePasswordForm
- type ComponentClient
- type SingleInteger
- type SingleString
Constants ¶
View Source
const OriginHeader = "Origin"
Variables ¶
View Source
var Logger = shared.ProvideLogger(os.Getenv("LOG_LEVEL"))
Functions ¶
func GenerateCookie ¶ added in v0.0.22
func GetCorsDisablingHandler ¶ added in v0.0.21
GetCorsDisablingHandler This is necessary to allow cross-origin requests from the Ocelot-Cloud GUI to the Hub. or when testing frontend and backend components separately. The "Origin" header is managed and checked with custom logic to prevent CSRF attacks. TODO Rename to ApplyCorsDisable
func GetTimeIn30Days ¶ added in v0.0.22
func SaltAndHash ¶ added in v0.0.23
func SendJsonResponse ¶
func SendJsonResponse(w http.ResponseWriter, data interface{})
func SetCookieAndOriginHeaders ¶
func SetCookieAndOriginHeaders(req *http.Request, c *ComponentClient)
func UnpackResponse ¶ added in v0.0.32
func ZipDirectoryToBytes ¶ added in v0.0.30
Types ¶
type ChangePasswordForm ¶
type ComponentClient ¶
type ComponentClient struct {
User string
Password string
NewPassword string
Origin string
Cookie *http.Cookie
SetOriginHeader bool
SetCookieHeader bool
RootUrl string
}
func (*ComponentClient) DoRequest ¶
func (c *ComponentClient) DoRequest(path string, payload interface{}, expectedMessage string) (interface{}, error)
func (*ComponentClient) DoRequestWithFullResponse ¶
type SingleInteger ¶ added in v0.0.33
type SingleInteger struct {
Value int `json:"value"`
}
type SingleString ¶
type SingleString struct {
Value string `json:"value"`
}
Click to show internal directories.
Click to hide internal directories.