@Test public void testMergeWithValidAggregateInfo() { AuthenticationInfo aggregate = new MergableAuthenticationInfo() { @Override public void merge(AuthenticationInfo info) { } @Override public PrincipalCollection getPrincipals() { return new SimplePrincipalCollection("principals", "realmName"); } @Override public Object getCredentials() { return null; } }; AuthenticationInfo mergeResult = strategy.merge(new SimpleAuthenticationInfo(), aggregate); assertEquals(aggregate, mergeResult); }
protected AuthenticationInfo merge(AuthenticationInfo info, AuthenticationInfo aggregate) { if (aggregate != null && !isEmpty(aggregate.getPrincipals())) { return aggregate; } return info != null ? info : aggregate; }
FirstSuccessfulStrategy extends AbstractAuthenticationStrategy { protected AuthenticationInfo merge(AuthenticationInfo info, AuthenticationInfo aggregate) { if (aggregate != null && !isEmpty(aggregate.getPrincipals())) { return aggregate; } return info != null ? info : aggregate; } }
FirstSuccessfulStrategy extends AbstractAuthenticationStrategy { protected AuthenticationInfo merge(AuthenticationInfo info, AuthenticationInfo aggregate) { if (aggregate != null && !isEmpty(aggregate.getPrincipals())) { return aggregate; } return info != null ? info : aggregate; }  }
FirstSuccessfulStrategy extends AbstractAuthenticationStrategy { protected AuthenticationInfo merge(AuthenticationInfo info, AuthenticationInfo aggregate) { if (aggregate != null && !isEmpty(aggregate.getPrincipals())) { return aggregate; } return info != null ? info : aggregate; }  void setStopAfterFirstSuccess(boolean stopAfterFirstSuccess ); boolean getStopAfterFirstSuccess(); AuthenticationInfo beforeAllAttempts(Collection<? extends Realm> realms, AuthenticationToken token); AuthenticationInfo beforeAttempt(Realm realm, AuthenticationToken token, AuthenticationInfo aggregate); }
FirstSuccessfulStrategy extends AbstractAuthenticationStrategy { protected AuthenticationInfo merge(AuthenticationInfo info, AuthenticationInfo aggregate) { if (aggregate != null && !isEmpty(aggregate.getPrincipals())) { return aggregate; } return info != null ? info : aggregate; }  void setStopAfterFirstSuccess(boolean stopAfterFirstSuccess ); boolean getStopAfterFirstSuccess(); AuthenticationInfo beforeAllAttempts(Collection<? extends Realm> realms, AuthenticationToken token); AuthenticationInfo beforeAttempt(Realm realm, AuthenticationToken token, AuthenticationInfo aggregate);  }