use of org.apache.shiro.authc.pam.FirstSuccessfulStrategy in project graylog2-server by Graylog2.
the class SessionCreatorTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
SimpleAccountRealm realm = new SimpleAccountRealm();
realm.addAccount(validToken.getUsername(), String.valueOf(validToken.getPassword()));
// Set up a security manager like in DefaultSecurityManagerProvider
securityManager = new DefaultSecurityManager(realm);
FirstSuccessfulStrategy strategy = new ThrowingFirstSuccessfulStrategy();
strategy.setStopAfterFirstSuccess(true);
((ModularRealmAuthenticator) securityManager.getAuthenticator()).setAuthenticationStrategy(strategy);
SecurityUtils.setSecurityManager(securityManager);
}
Aggregations