private RegexRegisteredService mockService(final String... providers) {
   final DefaultRegisteredServiceMultifactorPolicy policy =
       new DefaultRegisteredServiceMultifactorPolicy();
   policy.setMultifactorAuthenticationProviders(ImmutableSet.copyOf(providers));
   final RegexRegisteredService service = new RegexRegisteredService();
   service.setMultifactorPolicy(policy);
   return service;
 }
  private RegexRegisteredService mockPrincipalService(
      final String provider, final String attrName, final String attrValue) {
    final RegexRegisteredService service = mockService(provider);
    final DefaultRegisteredServiceMultifactorPolicy policy =
        (DefaultRegisteredServiceMultifactorPolicy) service.getMultifactorPolicy();
    policy.setPrincipalAttributeNameTrigger(attrName);
    policy.setPrincipalAttributeValueToMatch(attrValue);

    return service;
  }