utils

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const OriginHeader = "Origin"

Variables

View Source
var Logger = shared.ProvideLogger(os.Getenv("LOG_LEVEL"))

Functions

func GetCorsDisablingHandler added in v0.0.21

func GetCorsDisablingHandler(next http.Handler) http.Handler

GetCorsDisablingHandler This is necessary to allow cross-origin requests from the ocelot-cloud GUI to the hub. The "Origin" header is managed and checked with custom logic to prevent CSRF attacks.

func GetErrMsg

func GetErrMsg(actualStatusCode int, respBodyMsg string) string

func SendJsonResponse

func SendJsonResponse(w http.ResponseWriter, data interface{})

func SetCookieAndOriginHeaders

func SetCookieAndOriginHeaders(req *http.Request, c *ComponentClient)

Types

type ChangePasswordForm

type ChangePasswordForm struct {
	OldPassword string `json:"old_password"`
	NewPassword string `json:"new_password"`
}

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

func (c *ComponentClient) DoRequestWithFullResponse(path string, payload interface{}, expectedMessage string) (*http.Response, error)

type SingleString

type SingleString struct {
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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