Saml2ExchangeAuthFrameworkValidator extends SamlAssertionValidator { protected static void validateNameIdFormatValue(final String format, final String value) throws WSSecurityException { if (SamlConstants.AUTH_FRWK_NAME_ID_FORMAT_EMAIL_ADDRESS.equals(format)) { validateEmail(value); } else if (SamlConstants.AUTH_FRWK_NAME_ID_FORMAT_X509.equals(format)) { validateName(value); } else if (SamlConstants.AUTH_FRWK_NAME_ID_FORMAT_WINDOWS_NAME.equals(format)) { validateParts(value); } }    }
@Test public void testValidateNameX509validValue() throws WSSecurityException { Saml2ExchangeAuthFrameworkValidator validator = new Saml2ExchangeAuthFrameworkValidator(); validator.validateNameIdFormatValue(SamlConstants.AUTH_FRWK_NAME_ID_FORMAT_WINDOWS_NAME, "org/emailAddress"); }
@Test(expected = WSSecurityException.class) public void testValidateNameX509InValidValue() throws WSSecurityException { Saml2ExchangeAuthFrameworkValidator validator = new Saml2ExchangeAuthFrameworkValidator(); validator.validateNameIdFormatValue(SamlConstants.AUTH_FRWK_NAME_ID_FORMAT_WINDOWS_NAME, "test\\test2\\test3"); }