}
public void start(HttpServer httpServer, SecurityRealm securityRealm) {
// The SubjectAssociationHandler wraps all calls to this HttpHandler to ensure the Subject has been associated
// with the security context.
HttpContext context = httpServer.createContext(DOMAIN_API_CONTEXT, new SubjectAssociationHandler(this));
// Once there is a trust store we can no longer rely on users being defined so skip
// any redirects.
if (authenticator != null) {
context.setAuthenticator(authenticator);
List<Filter> filters = context.getFilters();
if (securityRealm.hasTrustStore() == false) {
DomainCallbackHandler callbackHandler = securityRealm.getCallbackHandler();
filters.add(new RealmReadinessFilter(callbackHandler, ErrorHandler.getRealmRedirect()));
}
}