Search in sources :

Example 1 with ConfigurableApiBuilder

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;
}
Also used : ConfigurableApiBuilder(com.symphony.api.bindings.ConfigurableApiBuilder) ProxyProperties(org.finos.symphony.toolkit.spring.api.properties.ProxyProperties)

Example 2 with ConfigurableApiBuilder

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);
}
Also used : ConfigurableApiBuilder(com.symphony.api.bindings.ConfigurableApiBuilder) PodProperties(org.finos.symphony.toolkit.spring.api.properties.PodProperties)

Example 3 with ConfigurableApiBuilder

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;
}
Also used : ConfigurableApiBuilder(com.symphony.api.bindings.ConfigurableApiBuilder) ApiWrapper(com.symphony.api.bindings.ApiWrapper)

Example 4 with ConfigurableApiBuilder

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;
}
Also used : CXFApiBuilder(com.symphony.api.bindings.cxf.CXFApiBuilder) TokenManagingApiInstanceFactory(org.finos.symphony.toolkit.spring.api.factories.TokenManagingApiInstanceFactory) SymphonyIdentity(com.symphony.api.id.SymphonyIdentity) ApiInstance(org.finos.symphony.toolkit.spring.api.factories.ApiInstance) ApiBuilderFactory(org.finos.symphony.toolkit.spring.api.builders.ApiBuilderFactory) ApiInstanceFactory(org.finos.symphony.toolkit.spring.api.factories.ApiInstanceFactory) TokenManagingApiInstanceFactory(org.finos.symphony.toolkit.spring.api.factories.TokenManagingApiInstanceFactory) CXFApiBuilder(com.symphony.api.bindings.cxf.CXFApiBuilder) ApiBuilder(com.symphony.api.bindings.ApiBuilder) ConfigurableApiBuilder(com.symphony.api.bindings.ConfigurableApiBuilder)

Example 5 with ConfigurableApiBuilder

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;
}
Also used : ExtensionAppTokens(com.symphony.api.model.ExtensionAppTokens) ConfigurableApiBuilder(com.symphony.api.bindings.ConfigurableApiBuilder) ExtensionAppAuthenticateRequest(com.symphony.api.model.ExtensionAppAuthenticateRequest) CertificateAuthenticationApi(com.symphony.api.authenticator.CertificateAuthenticationApi)

Aggregations

ConfigurableApiBuilder (com.symphony.api.bindings.ConfigurableApiBuilder)5 CertificateAuthenticationApi (com.symphony.api.authenticator.CertificateAuthenticationApi)1 ApiBuilder (com.symphony.api.bindings.ApiBuilder)1 ApiWrapper (com.symphony.api.bindings.ApiWrapper)1 CXFApiBuilder (com.symphony.api.bindings.cxf.CXFApiBuilder)1 SymphonyIdentity (com.symphony.api.id.SymphonyIdentity)1 ExtensionAppAuthenticateRequest (com.symphony.api.model.ExtensionAppAuthenticateRequest)1 ExtensionAppTokens (com.symphony.api.model.ExtensionAppTokens)1 ApiBuilderFactory (org.finos.symphony.toolkit.spring.api.builders.ApiBuilderFactory)1 ApiInstance (org.finos.symphony.toolkit.spring.api.factories.ApiInstance)1 ApiInstanceFactory (org.finos.symphony.toolkit.spring.api.factories.ApiInstanceFactory)1 TokenManagingApiInstanceFactory (org.finos.symphony.toolkit.spring.api.factories.TokenManagingApiInstanceFactory)1 PodProperties (org.finos.symphony.toolkit.spring.api.properties.PodProperties)1 ProxyProperties (org.finos.symphony.toolkit.spring.api.properties.ProxyProperties)1