Beispiel #1
0
func (t *Toolbox) containerAuthenticate(_ toolbox.VixCommandRequestHeader, data []byte) error {
	var c toolbox.VixUserCredentialNamePassword
	if err := c.UnmarshalBinary(data); err != nil {
		return err
	}
	// no authentication yet, just using container ID as a sanity check for now
	if c.Name != t.config.ID {
		return errors.New("failed to verify container ID")
	}

	return nil
}
Beispiel #2
0
func (t *Toolbox) containerAuthenticate(_ toolbox.VixCommandRequestHeader, data []byte) error {
	var c toolbox.VixUserCredentialNamePassword
	if err := c.UnmarshalBinary(data); err != nil {
		return err
	}

	session := t.session()
	if session == nil {
		return errors.New("not yet initialized")
	}

	session.Lock()
	defer session.Unlock()

	// no authentication yet, just using container ID as a sanity check for now
	if c.Name != session.ID {
		return errors.New("failed to verify container ID")
	}

	return nil
}