func TestValidateHTTPS(t *testing.T) {
	va := NewValidationAuthorityImpl(true)
	mockRA := &MockRegistrationAuthority{}
	va.RA = mockRA

	challHTTPS := core.SimpleHTTPSChallenge()
	challHTTPS.Path = "test"

	stopChanHTTPS := make(chan bool, 1)
	waitChanHTTPS := make(chan bool, 1)
	go simpleSrv(t, challHTTPS.Token, stopChanHTTPS, waitChanHTTPS)

	// Let them start
	<-waitChanHTTPS

	// shutdown cleanly
	defer func() {
		stopChanHTTPS <- true
	}()

	var authz = core.Authorization{
		ID:             core.NewToken(),
		RegistrationID: 1,
		Identifier:     ident,
		Challenges:     []core.Challenge{challHTTPS},
	}
	va.validate(authz)

	test.AssertEquals(t, core.StatusValid, mockRA.lastAuthz.Challenges[0].Status)
}
Esempio n. 2
0
// For now, we just issue DVSNI and SimpleHTTPS challenges for everything
func (pa PolicyAuthorityImpl) ChallengesFor(identifier core.AcmeIdentifier) (challenges []core.Challenge, combinations [][]int) {
	challenges = []core.Challenge{
		core.SimpleHTTPSChallenge(),
		core.DvsniChallenge(),
	}
	combinations = [][]int{
		[]int{0},
		[]int{1},
	}
	return
}