use of com.symphony.api.bindings.ConfigurableApiBuilder in project spring-bot by finos.
the class PodInfoStoreTokenStrategy method setupApiBuilder.
private ApiBuilder setupApiBuilder(PodInfo pod, String url) throws Exception {
ConfigurableApiBuilder ab = abf.getObject();
ab.setUrl(url);
ab.setKeyManagers(appIdentity.getKeyManagers());
ab.setTrustManagers(trustManagers);
if (pod.getUseProxy() != Boolean.FALSE) {
ProxyProperties proxy = appProperties.getProxy();
if (proxy != null) {
proxy.configure(ab);
}
}
return ab;
}
use of com.symphony.api.bindings.ConfigurableApiBuilder in project spring-bot by finos.
the class ConfiguredPodTokenStrategy method getPodApi.
@Override
protected PodApi getPodApi(Map<String, Object> claims) throws Exception {
String companyId = getCompanyId(claims);
PodProperties pp = getPodProperties(companyId);
if (pp == null) {
return null;
}
ConfigurableApiBuilder ab = abf.getObject();
pp.getPod().configure(ab, new ApiWrapper[] {}, appIdentity, trustManagers);
return ab.getApi(PodApi.class);
}
use of com.symphony.api.bindings.ConfigurableApiBuilder in project spring-bot by finos.
the class AbstractGenericInstanceFactory method createApiBuilder.
/**
* Override this method to configure your own ApiBuilder implementation.
*/
protected ConfigurableApiBuilder createApiBuilder(PodProperties pp, EndpointProperties ep, ID id, TrustManager[] trustManagers, String apiName, ApiWrapper... extra) throws Exception {
if (ep == null) {
LOG.warn("symphony.apis[{}].{} not set: could cause NPE when doing get{}Api()", pp.getId(), apiName.toLowerCase(), StringUtils.capitalize(apiName));
return null;
}
List<ApiWrapper> wrappers = buildApiWrappers(pp, id, ep);
Arrays.stream(extra).forEach(w -> wrappers.add(w));
ApiWrapper[] wrapperArray = wrappers.stream().toArray(s -> new ApiWrapper[s]);
ConfigurableApiBuilder ab = apiBuilderFactory.getObject();
ep.configure(ab, wrapperArray, getIdentity(id), trustManagers);
return ab;
}
use of com.symphony.api.bindings.ConfigurableApiBuilder in project spring-bot by finos.
the class SymphonyAdminController method getAPI.
protected <X> X getAPI(Class<X> x) throws IOException, Exception {
Config config = getConfig();
SymphonyIdentity identity = IdentityProperties.instantiateIdentityFromDetails(rl, config.getIdentityProperties(), getObjectMapper());
ApiBuilderFactory abf = new ApiBuilderFactory() {
@Override
public boolean isSingleton() {
return false;
}
@Override
public Class<?> getObjectType() {
return ApiBuilder.class;
}
@Override
public ConfigurableApiBuilder getObject() throws Exception {
return new CXFApiBuilder();
}
};
ApiInstanceFactory apiInstanceFactory = new TokenManagingApiInstanceFactory(abf);
ApiInstance instance = apiInstanceFactory.createApiInstance(identity, config.getPodProperties(), null);
X out = instance.getAgentApi(x);
return out;
}
use of com.symphony.api.bindings.ConfigurableApiBuilder in project spring-bot by finos.
the class ConfiguredPodTokenStrategy method certBasedRequest.
protected ExtensionAppTokens certBasedRequest(String appToken, PodProperties pod) throws Exception {
ConfigurableApiBuilder ab = abf.getObject();
pod.getSessionAuth().configure(ab, new ApiWrapper[] {}, appIdentity, trustManagers);
CertificateAuthenticationApi aa = ab.getApi(CertificateAuthenticationApi.class);
ExtensionAppAuthenticateRequest ar = new ExtensionAppAuthenticateRequest();
ar.setAppToken(appToken);
ExtensionAppTokens out = aa.v1AuthenticateExtensionAppPost(ar);
return out;
}
Aggregations