コード例 #1
0
// DoRunTestKrib
func DoRunTestKrib(m modsset, overwrite *Testparams) (tp *Testparams) {
	if !*dokrib {
		return
	}
	tp = Newtp(overwrite)
	defer xxx(tp.Trace)
	tp.Usedoubleproxy = true

	ApplyMods(tp.Attributestmt, m["attributemods"])
	tp.SSOCreateInitialRequest()
	ApplyMods(tp.Initialrequest, m["requestmods"])
	//    log.Println(tp.Initialrequest.Pp())
	tp.SSOSendRequest1()
	if tp.Resp.StatusCode == 500 {
		fmt.Println(strings.TrimSpace(string(tp.Responsebody)))
		return
	}
	authnrequest := gosaml.Url2SAMLRequest(tp.Resp.Location())
	ApplyMods(authnrequest, m["birkrequestmods"])
	u, _ := gosaml.SAMLRequest2Url(authnrequest, "", "", "")
	tp.Resp.Header.Set("Location", u.String())
	if tp.Resp.StatusCode == 500 {
		fmt.Println(strings.TrimSpace(string(tp.Responsebody)))
		return
	}
	tp.SSOSendRequest2()
	if tp.Newresponse == nil {
		log.Panic(string(tp.Responsebody))
	}
	tp.SSOSendResponse()
	if tp.Resp.StatusCode == 500 {
		fmt.Println(strings.TrimSpace(string(tp.Responsebody)))
		return
	}

	tp.SSOSendResponse()
	if tp.Resp.StatusCode == 500 {
		fmt.Println(strings.TrimSpace(string(tp.Responsebody)))
		return
	}
	if tp.Logxml {
		log.Println("final response", tp.Newresponse.Pp())
	}
	return
}
コード例 #2
0
// DoRunTestBirk runs a test on the hub - applying the necessary modifications on the way
// Returns a *Testparams which can be analyzed
func DoRunTestBirk(m modsset, overwrite *Testparams) (tp *Testparams) {
	if !*dobirk {
		return
	}
	tp = Newtp(overwrite)
	defer xxx(tp.Trace)
	tp.Firstidpmd = tp.Birkmd
	tp.Usedoubleproxy = true

	ApplyMods(tp.Attributestmt, m["attributemods"])
	tp.SSOCreateInitialRequest()
	ApplyMods(tp.Initialrequest, m["requestmods"])
	//    log.Println(tp.Initialrequest.Pp())
	tp.SSOSendRequest1()
	if tp.Resp.StatusCode == 500 {
		fmt.Println(strings.Trim(strings.SplitN(string(tp.Responsebody), " ", 2)[1], "\n "))
		return
	}
	authnrequest := gosaml.Url2SAMLRequest(tp.Resp.Location())
	ApplyMods(authnrequest, m["birkrequestmods"])
	//    log.Println(authnrequest.Pp())
	u, _ := gosaml.SAMLRequest2Url(authnrequest, "", "", "")
	tp.Resp.Header.Set("Location", u.String())
	tp.SSOSendRequest2()
	// pt. after signing - remember to have a before as well

	if tp.Resp.StatusCode == 500 {
		fmt.Println(strings.SplitN(string(tp.Responsebody), " ", 2)[1])
		return
	}
	tp.SSOSendResponse()
	if tp.Resp.StatusCode == 500 {
		fmt.Println(strings.SplitN(string(tp.Responsebody), " ", 2)[1])
		return
	}
	ApplyMods(tp.Newresponse, m["responsemods"])
	tp.SSOSendResponse()
	if tp.Resp.StatusCode == 500 {
		fmt.Println(strings.Trim(strings.SplitN(string(tp.Responsebody), " ", 2)[1], "\n "))
		return
	}
	return
}