//Validate checks the totp code for a specific username
553707
func (pwm *Manager) Validate(username, securityCode string) (bool, error) {

	var storedSecret userSecret
	if err := pwm.collection.Find(bson.M{"username": username}).One(&storedSecret); err != nil {
		if err == mgo.ErrNotFound {
			log.Debug("No totpsecret found for this user")
			return false, nil
		}
		log.Debug(err)
		return false, err
	}
	token := TokenFromSecret(storedSecret.Secret)
	match := token.Validate(securityCode)
	return match, nil
}
71214
func (ref *Ref) Validate(serializedID []byte) error {
	membership, err := ref.get()
	if err != nil {
		return err
	}
	return membership.Validate(serializedID)
}
383613
func (m *NewTask) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateImage(formats); err != nil {
		// prop
		res = append(res, err)
	}

	if err := m.validatePriority(formats); err != nil {
		// prop
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
1110220
func (pwm *Manager) Validate(username, password string) (bool, error) {
	var storedPassword userPass
	if err := pwm.collection.Find(bson.M{"username": username}).One(&storedPassword); err != nil {
		if err == mgo.ErrNotFound {
			log.Debug("No password found for this user")
			return false, nil
		}
		log.Debug(err)
		return false, err
	}
	match := keyderivation.Check(password, storedPassword.Password)
	return match, nil
}
233670
func (s *IndicesPutTemplateService) Validate() error {
	var invalid []string
	if s.name == "" {
		invalid = append(invalid, "Name")
	}
	if s.bodyString == "" && s.bodyJson == nil {
		invalid = append(invalid, "BodyJson")
	}
	if len(invalid) > 0 {
		return fmt.Errorf("missing required fields: %v", invalid)
	}
	return nil
}
477425
func (m *Principal_Authenticated) Validate() error {
	if m == nil {
		return nil
	}

	{
		tmp := m.GetPrincipalName()

		if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

			if err := v.Validate(); err != nil {
				return Principal_AuthenticatedValidationError{
					field:  "PrincipalName",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}
	}

	return nil
}
849694
func (i *I) Validate(ctx *Context) error {
	_, err := i.template(ctx)
	return err
}
1347857
func (m *HandledLoginRequest) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateSubject(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
364989
func (u *UserTypeDefinition) Validate(ctx string, parent dslengine.Definition) *dslengine.ValidationErrors {
	verr := new(dslengine.ValidationErrors)
	if u.TypeName == "" {
		verr.Add(parent, "%s - %s", ctx, "User type must have a name")
	}
	verr.Merge(u.AttributeDefinition.Validate(ctx, u))
	return verr.AsError()
}
127411
func (m *HttpStatus) Validate() error {
	if m == nil {
		return nil
	}

	if _, ok := StatusCode_name[int32(m.GetCode())]; !ok {
		return HttpStatusValidationError{
			field:  "Code",
			reason: "value must be one of the defined enum values",
		}
	}

	return nil
}
1004410
func (v *JSVal) Validate(x interface{}) error {
	name := v.Name
	if len(name) == 0 {
		return errors.Wrapf(v.root.Validate(x), "validator %p failed", v)
	}
	return errors.Wrapf(v.root.Validate(x), "validator %s failed", name)
}
1158102
func (s ConfigMapGeneratorV1) validate() error {
	if len(s.Name) == 0 {
		return fmt.Errorf("name must be specified")
	}
	return nil
}
1374553
func (m *JwtHeader) Validate() error {
	if m == nil {
		return nil
	}

	if len(m.GetName()) < 1 {
		return JwtHeaderValidationError{
			field:  "Name",
			reason: "value length must be at least 1 bytes",
		}
	}

	// no validation rules for ValuePrefix

	return nil
}
471122
func (userStrategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList {
	return validation.ValidateUser(obj.(*userapi.User))
}
1243240
func (s *templateInstanceStrategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList {
	user, ok := apirequest.UserFrom(ctx)
	if !ok {
		return field.ErrorList{field.InternalError(field.NewPath(""), errors.New("user not found in context"))}
	}

	templateInstance := obj.(*templateapi.TemplateInstance)
	allErrs := validation.ValidateTemplateInstance(templateInstance)
	allErrs = append(allErrs, s.validateImpersonation(templateInstance, user)...)

	return allErrs
}
327475
func (e *RequiredValidator) Validate(s interface{}) error {
	if e.TagName == "" {
		e.TagName = "required"
	}

	if e.TagValue == "" {
		e.TagValue = "true"
	}

	for _, field := range structs.Fields(s) {
		if err := e.processField("", field); err != nil {
			return err
		}
	}

	return nil
}
312190
func (c *Config) Validate() error {
	if err := c.validateTemplates(); err != nil {
		return err
	}

	return nil
}