Validate issuer format and value.

@param issuer  the issuer
@param context the context
9938
protected final void validateIssuer(final Issuer issuer, final SAML2MessageContext context) {
        if (issuer.getFormat() != null && !issuer.getFormat().equals(NameIDType.ENTITY)) {
            throw new SAMLIssuerException("Issuer type is not entity but " + issuer.getFormat());
        }

        final String entityId = context.getSAMLPeerEntityContext().getEntityId();
        if (entityId == null || !entityId.equals(issuer.getValue())) {
            throw new SAMLIssuerException("Issuer " + issuer.getValue() + " does not match idp entityId " + entityId);
        }
    }
336499
@Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        try {
            this.duracloudUserService.checkUsername(value);
        } catch (InvalidUsernameException ex) {
            context.disableDefaultConstraintViolation();
            String message;
            if (ex instanceof ReservedUsernameException) {
                message = RESERVED_USERNAME_MESSAGE;
            } else if (ex instanceof ReservedPrefixException) {
                message = RESERVED_PREFIX_MESSAGE;
            } else {
                message = INVALID_USERNAME_MESSAGE;
            }

            message = MessageFormat.format(message, value);
            ConstraintViolationBuilder cvb =
                context.buildConstraintViolationWithTemplate(message);
            cvb.addConstraintViolation();
            return false;
        } catch (UserAlreadyExistsException ex) {
            return false;
        }

        return true;
    }
52273
public void validate(StateAccess validationState, ValidationMessageAcceptor messageAcceptor) {
		if (isResponsible(validationState.getState().context, validationState.getState().currentObject)) {
			try {
				for (final MethodWrapper method : getMethods(validationState.getState().currentObject)) {
					final Context ctx = new Context(validationState, this, method, messageAcceptor);
					this.currentContext.set(ctx);
					initializeContext(ctx);
					method.invoke(ctx);
				}
			} finally {
				this.currentContext.set(null);
			}
		}
	}
186369
public static void accept(SARLQuickfixProvider provider, Issue issue, IssueResolutionAcceptor acceptor) {
		final FiredEventRemoveModification modification = new FiredEventRemoveModification();
		modification.setIssue(issue);
		modification.setTools(provider);
		acceptor.accept(issue,
				Messages.SARLQuickfixProvider_0,
				Messages.SARLQuickfixProvider_8,
				JavaPluginImages.IMG_CORRECTION_REMOVE,
				modification,
				IProposalRelevance.REMOVE_EXCEPTIONS);
	}
713821
def add_kb(self, issuer, kb):
        
        try:
            self.issuer_keys[issuer].append(kb)
        except KeyError:
            self.issuer_keys[issuer] = [kb]
386410
public void validate(final ValidationContext context) {
        if (!context.getUserEvent().equalsIgnoreCase("submit")) {
            return;
        }

        val messages = context.getMessageContext();
        ApplicationContextProvider.getCasConfigurationProperties().ifPresent(props -> {
            if (StringUtils.isBlank(source) && props.getAuthn().getPolicy().isSourceSelectionEnabled()) {
                messages.addMessage(new MessageBuilder()
                    .error()
                    .source("source")
                    .code("source.required")
                    .build());
            }
        });
    }
15351
@Override
  public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
    if (pvalue == null) {
      return true;
    }
    try {
      final String field1Value =
          getDomainOf(BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, field1Name));
      final String field2Value =
          getDomainOf(BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, field2Name));
      if (!StringUtils.equals(field1Value, field2Value)) {
        switchContext(pcontext);
        return false;
      }
      return true;
    } catch (final Exception ignore) {
      switchContext(pcontext);
      return false;
    }
  }
431429
public void validate(final Object record, final CsvBindingErrors bindingErrors, 
            final ValidationContext<Object> validationContext, final Class<?>... groups) {
        Objects.requireNonNull(record);
        Objects.requireNonNull(bindingErrors);
        Objects.requireNonNull(validationContext);
        
        processConstraintViolation(getTargetValidator().validate(record, groups), bindingErrors, validationContext);
    }
1196717
public Issuer newIssuer(final String issuerValue) {
        val issuer = newSamlObject(Issuer.class);
        issuer.setValue(issuerValue);
        return issuer;
    }
201596
@Override
    public void validateDefault(InputProblemReporter rep, boolean normalize)
        throws XMLStreamException
    {
        String def = validateDefaultNmToken(rep, normalize);
        if (normalize) {
            mDefValue.setValue(def);
        }
    }
819923
@Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        List<String> emailAddresses = EmailAddressesParser.parse(value);
        List<String> badAddresses = null;
        for (String ea : emailAddresses) {
            if (!EMAIL_VALIDATOR.isValid(ea, null)) {
                if (badAddresses == null) {
                    badAddresses = new LinkedList<String>();
                }

                badAddresses.add(ea);
            }
        }

        if (badAddresses != null) {
            context.disableDefaultConstraintViolation();
            context.buildConstraintViolationWithTemplate(MessageFormat.format(constraintAnnotation.message(),
                                                                              StringUtils.join(badAddresses, ", ")))
                   .addConstraintViolation();
        }
        return (badAddresses == null);
    }
683694
@SuppressWarnings("unchecked")
    public T validator(String ... validatorNames) {
        Assert.notNull(applicationContext, "Citrus application context is not initialized!");

        for (String validatorName : validatorNames) {
            getAction().addValidator(applicationContext.getBean(validatorName, MessageValidator.class));
        }

        return self;
    }
1043609
private static void validateEnvironment(SessionContext context, Executor executor) {
		System.out.print("Validating current environment...");
		try {
			executor.validateSession(context);
			System.out.println("done.");
		} catch (SqlExecutionException e) {
			throw new SqlClientException(
				"The configured environment is invalid. Please check your environment files again.", e);
		}
	}
549402
public void checkValidity() throws ACMValidationException {
                if (context == null) {
                        throw new ACMValidationException("Invalid state of AC model: No context assigned");
                }
                if (!getContext().containsActivities()) {
                        return;
                }
                for (String activity : getContext().getActivities()) {
                        try {
                                if (!isExecutable(activity)) {
                                        throw new ACMValidationException("Model contains non-executable transactions: " + activity);
                                }
                        } catch (CompatibilityException e) {
                                throw new ACMValidationException("Error during validation check: " + e.getMessage());
                        }
                }
        }
344528
private void setIssuer(Object val) throws CertificateException {
        if (!(val instanceof X500Name)) {
            throw new CertificateException(
                             "Issuer class type invalid.");
        }
        issuer = (X500Name)val;
    }
1099736
protected void validateAnnotationValue(T originatingElement, String annotationName, T member, String memberName, Object resolvedValue) {
        final AnnotatedElementValidator elementValidator = getElementValidator();
        if (elementValidator != null && !erroneousElements.contains(member)) {
            final boolean shouldValidate = !(annotationName.equals(AliasFor.class.getName())) &&
                                           (!(resolvedValue instanceof String) || !resolvedValue.toString().contains("${"));
            if (shouldValidate) {
                final Set<String> errors = elementValidator.validatedAnnotatedElement(new AnnotatedElement() {

                    AnnotationMetadata metadata = buildDeclared(member);

                    @Nonnull
                    @Override
                    public String getName() {
                        return memberName;
                    }

                    @Override
                    public AnnotationMetadata getAnnotationMetadata() {
                        return metadata;
                    }
                }, resolvedValue);

                if (CollectionUtils.isNotEmpty(errors)) {
                    erroneousElements.add(member);
                    for (String error : errors) {
                        error = "@" + NameUtils.getSimpleName(annotationName) + "." + memberName + ": " + error;
                        addError(originatingElement, error);
                    }
                }
            }
        }
    }
584972
private function is_ready_for_login_page(\core\oauth2\issuer $issuer) {
        return $issuer->get('enabled') &&
                $issuer->is_configured() &&
                !empty($issuer->get('showonloginpage'));
    }