util

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuth

func BasicAuth(w http.ResponseWriter, r *http.Request, username, password string) bool

BasicAuth validate if user/pass in the http request match the configured service broker user/pass

func Contains

func Contains(elems []interface{}, v string) bool

func DumpRequest

func DumpRequest(r *http.Request)

func GetAccessTokenFromRequest

func GetAccessTokenFromRequest(r *http.Request) (string, error)

GetAccessTokenFromRequest - get the JWT from the request

func GetOrgByGuidCached

func GetOrgByGuidCached(guid string) (org *resource.Organization)

func GetSpaceByGuidCached

func GetSpaceByGuidCached(guid string) (space *resource.Space)

func Guid2AppName

func Guid2AppName(guid string) string

func InitCFClient

func InitCFClient()

func IsUserAuthorisedForSpace

func IsUserAuthorisedForSpace(token jwt.Token, spaceGuid string) bool

IsUserAuthorisedForSpace - It takes the jwt, extracts the userId from it, then queries cf (/v3/roles) to check if that user has at least developer or manager role for the give space

func IsValidJKU

func IsValidJKU(jkuURL string) bool

IsValidJKU - We compare the jku with the api hostname, only the first part should be different: like uaa.sys.cfd04.aws.rabo.cloud versus api.sys.cfd04.aws.rabo.cloud

func PrintIfDebug

func PrintIfDebug(msg string)

func PrintfIfDebug

func PrintfIfDebug(msg string, args ...interface{})

func ProvisionObjectFromRequest

func ProvisionObjectFromRequest(r *http.Request, object interface{}) error

func Send2PolicyServer

func Send2PolicyServer(action string, policies model.NetworkPolicies) error

Send2PolicyServer - Send the give network policies to the cf policy server (actual update/add of the network policy). If a policy already exists, it will be ignored.

func SyncLabels2Policies added in v1.0.4

func SyncLabels2Policies()

SyncLabels2Policies - Find all ServiceInstances and their bound apps, figure out what network policies they represent, check if they exist, and if not, report and create them.

func WriteHttpResponse

func WriteHttpResponse(w http.ResponseWriter, code int, object interface{})

Types

type CacheEntry

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

Jump to

Keyboard shortcuts

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