Add support for /ssh/bastion method.

This commit is contained in:
Mariano Cano 2019-11-14 18:24:58 -08:00
parent 8585b29711
commit 86a0558587
8 changed files with 197 additions and 2 deletions

View file

@ -557,6 +557,7 @@ type mockAuthority struct {
getSSHFederation func() (*authority.SSHKeys, error)
getSSHConfig func(typ string, data map[string]string) ([]templates.Output, error)
checkSSHHost func(principal string) (bool, error)
getSSHBastion func(user string, hostname string) (*authority.Bastion, error)
}
// TODO: remove once Authorize is deprecated.
@ -711,6 +712,13 @@ func (m *mockAuthority) CheckSSHHost(principal string) (bool, error) {
return m.ret1.(bool), m.err
}
func (m *mockAuthority) GetSSHBastion(user string, hostname string) (*authority.Bastion, error) {
if m.getSSHBastion != nil {
return m.getSSHBastion(user, hostname)
}
return m.ret1.(*authority.Bastion), m.err
}
func Test_caHandler_Route(t *testing.T) {
type fields struct {
Authority Authority