use of com.predic8.membrane.core.Router in project service-proxy by membrane.
the class JavascriptInterceptor method init.
@Override
public void init() throws IOException, ClassNotFoundException {
if (router == null)
return;
if ("".equals(src))
return;
jls = new JavascriptLanguageSupport();
implicitClasses = getJavascriptTypesForHttpClasses();
script = jls.compileScript(router, src);
}
use of com.predic8.membrane.core.Router in project service-proxy by membrane.
the class OAuth2AuthorizationServerInterceptor method init.
@Override
public void init(Router router) throws Exception {
name = "OAuth 2 Authorization Server";
setFlow(Flow.Set.REQUEST_RESPONSE);
this.setRouter(router);
addSupportedAuthorizationGrants();
getWellknownFile().init(router, this);
getConsentPageFile().init(router, getConsentFile());
if (userDataProvider == null)
throw new Exception("No userDataProvider configured. - Cannot work without one.");
if (getClientList() == null)
throw new Exception("No clientList configured. - Cannot work without one.");
if (getClaimList() == null)
throw new Exception("No scopeList configured. - Cannot work without one");
if (getLocation() == null) {
log.warn("===========================================================================================");
log.warn("IMPORTANT: No location configured - Authorization code and implicit flows are not available");
log.warn("===========================================================================================");
loginViewDisabled = true;
}
if (getConsentFile() == null && !isLoginViewDisabled()) {
log.warn("==============================================================================================");
log.warn("IMPORTANT: No consentFile configured - Authorization code and implicit flows are not available");
log.warn("==============================================================================================");
loginViewDisabled = true;
}
if (getPath() == null)
throw new Exception("No path configured. - Cannot work without one");
userDataProvider.init(router);
getClientList().init(router);
getClaimList().init(router);
jwtGenerator = new JwtGenerator();
sessionManager.init(router);
statistics = new OAuth2Statistics();
addDefaultProcessors();
new CleanupThread(sessionManager, accountBlocker).start();
}
use of com.predic8.membrane.core.Router in project service-proxy by membrane.
the class OAuth2ResourceInterceptor method init.
@Override
public void init(Router router) throws Exception {
name = "OAuth 2 Client";
setFlow(Flow.Set.REQUEST_RESPONSE);
super.init(router);
auth.init(router);
statistics = new OAuth2Statistics();
uriFactory = router.getUriFactory();
if (sessionManager == null)
sessionManager = new SessionManager();
// TODO maybe do this differently as now the attribute in the bean is overwritten ( when set from external proxies.xml )
sessionManager.setCookieName("SESSION_ID_CLIENT");
sessionManager.init(router);
if (loginLocation != null) {
wsi = new WebServerInterceptor();
wsi.setDocBase(loginLocation);
router.getResolverMap().resolve(ResolverMap.combine(router.getBaseLocation(), wsi.getDocBase(), "./index.html")).close();
wsi.init(router);
}
if (publicURL == null)
initPublicURLOnFirstExchange = true;
else
normalizePublicURL();
firstInitWhenDynamicAuthorizationService = getAuthService().supportsDynamicRegistration();
if (!getAuthService().supportsDynamicRegistration())
firstInitWhenDynamicAuthorizationService = false;
new CleanupThread(sessionManager).start();
}
use of com.predic8.membrane.core.Router in project service-proxy by membrane.
the class ValidatorInterceptor method init.
@Override
public void init() throws Exception {
validator = null;
String baseLocation = router == null ? null : router.getBaseLocation();
if (wsdl != null) {
name = "SOAP Validator";
setValidator(new WSDLValidator(resourceResolver, ResolverMap.combine(baseLocation, wsdl), createFailureHandler(), skipFaults));
}
if (schema != null) {
name = "XML Schema Validator";
setValidator(new XMLSchemaValidator(resourceResolver, ResolverMap.combine(baseLocation, schema), createFailureHandler()));
}
if (jsonSchema != null) {
name = "JSON Schema Validator";
setValidator(new JSONValidator(resourceResolver, ResolverMap.combine(baseLocation, jsonSchema), createFailureHandler()));
}
if (schematron != null) {
name = "Schematron Validator";
setValidator(new SchematronValidator(resourceResolver, ResolverMap.combine(baseLocation, schematron), createFailureHandler(), router, applicationContext));
}
if (validator == null) {
Rule parent = router.getParentProxy(this);
if (parent instanceof SOAPProxy) {
wsdl = ((SOAPProxy) parent).getWsdl();
name = "SOAP Validator";
setValidator(new WSDLValidator(resourceResolver, ResolverMap.combine(baseLocation, wsdl), createFailureHandler(), skipFaults));
}
if (validator == null)
throw new Exception("<validator> must have an attribute specifying the validator.");
}
if (skipFaults && wsdl == null)
throw new Exception("validator/@skipFaults only makes sense with validator/@wsdl");
}
use of com.predic8.membrane.core.Router in project service-proxy by membrane.
the class LargeBodyTest method setup.
public void setup() throws Exception {
// streaming only works for maxRetries = 1
hcc = new HttpClientConfiguration();
hcc.setMaxRetries(1);
Rule rule = new ServiceProxy(new ServiceProxyKey("localhost", "POST", ".*", 3040), "thomas-bayer.com", 80);
rule.getInterceptors().add(new AbstractInterceptor() {
@Override
public Outcome handleRequest(Exchange exc) throws Exception {
exc.setResponse(Response.ok().body("").build());
return Outcome.RETURN;
}
});
router = new HttpRouter();
((HTTPClientInterceptor) router.getTransport().getInterceptors().get(3)).setHttpClientConfig(hcc);
router.getRuleManager().addProxyAndOpenPortIfNew(rule);
router.init();
Rule rule1 = new ServiceProxy(new ServiceProxyKey("localhost", "POST", ".*", 3041), "localhost", 3040);
router2 = new HttpRouter();
((HTTPClientInterceptor) router2.getTransport().getInterceptors().get(3)).setHttpClientConfig(hcc);
router2.getRuleManager().addProxyAndOpenPortIfNew(rule1);
router2.init();
}
Aggregations