Search in sources :

Example 11 with SymphonyIdentity

use of com.symphony.api.id.SymphonyIdentity in project spring-bot by finos.

the class SymphonyBuildReporter method prepareApi.

private SymphonyMessageSender prepareApi(MavenProject project) throws IOException {
    String identityJson = getProjectPropertyStrict(project, SYMPHONY_REPORTER_IDENTITY);
    SymphonyIdentity identity = new ObjectMapper().readValue(identityJson, SymphonyIdentity.class);
    String trustStoreJks = getProjectProperty(project, SYMPHONY_REPORTER_TRUST_STORE_JKS);
    String proxiesRaw = getProjectProperty(project, SYMPHONY_REPORTER_PROXIES);
    List<String> proxies;
    if (StringUtils.isEmpty(proxiesRaw)) {
        proxies = Collections.singletonList(null);
    } else {
        proxies = Arrays.stream(proxiesRaw.split(",")).filter(s -> !s.isEmpty()).map(x -> NONE_PROXY.equals(x) ? null : x).collect(Collectors.toList());
    }
    String podUrl = getProjectPropertyStrict(project, SYMPHONY_REPORTER_POD_URL);
    String agentUrl = getProjectPropertyStrict(project, SYMPHONY_REPORTER_AGENT_URL);
    String sessionauthUrl = getProjectProperty(project, SYMPHONY_REPORTER_SESSIONAUTH_URL);
    String keyauthUrl = getProjectProperty(project, SYMPHONY_REPORTER_KEYAUTH_URL);
    String relayUrl = getProjectProperty(project, SYMPHONY_REPORTER_RELAY_URL);
    String loginUrl = getProjectProperty(project, SYMPHONY_REPORTER_LOGIN_URL);
    ProxyingWrapper pod = new ProxyingWrapper(trustStoreJks, proxies, podUrl, identity, LOG);
    ProxyingWrapper agent = new ProxyingWrapper(trustStoreJks, proxies, agentUrl, identity, LOG);
    ProxyingWrapper session = sessionauthUrl == null ? null : new ProxyingWrapper(trustStoreJks, proxies, sessionauthUrl, identity, LOG);
    ProxyingWrapper key = keyauthUrl == null ? null : new ProxyingWrapper(trustStoreJks, proxies, keyauthUrl, identity, LOG);
    ProxyingWrapper relay = relayUrl == null ? null : new ProxyingWrapper(trustStoreJks, proxies, relayUrl, identity, LOG);
    ProxyingWrapper login = loginUrl == null ? null : new ProxyingWrapper(trustStoreJks, proxies, loginUrl, identity, LOG);
    return new SymphonyMessageSender(pod, agent, session, key, relay, login, identity);
}
Also used : CiManagement(org.apache.maven.model.CiManagement) AbstractMavenLifecycleParticipant(org.apache.maven.AbstractMavenLifecycleParticipant) Arrays(java.util.Arrays) SymphonyIdentity(com.symphony.api.id.SymphonyIdentity) Date(java.util.Date) LoggerFactory(org.slf4j.LoggerFactory) HashMap(java.util.HashMap) Component(org.codehaus.plexus.component.annotations.Component) MavenProject(org.apache.maven.project.MavenProject) Map(java.util.Map) MavenExecutionException(org.apache.maven.MavenExecutionException) PrintWriter(java.io.PrintWriter) BuildSummary(org.apache.maven.execution.BuildSummary) MavenSession(org.apache.maven.execution.MavenSession) Logger(org.slf4j.Logger) StringUtils(org.codehaus.plexus.util.StringUtils) StringWriter(java.io.StringWriter) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) IOException(java.io.IOException) MavenExecutionResult(org.apache.maven.execution.MavenExecutionResult) Collectors(java.util.stream.Collectors) List(java.util.List) BuildSuccess(org.apache.maven.execution.BuildSuccess) Notifier(org.apache.maven.model.Notifier) Collections(java.util.Collections) SymphonyIdentity(com.symphony.api.id.SymphonyIdentity) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 12 with SymphonyIdentity

use of com.symphony.api.id.SymphonyIdentity in project spring-bot by finos.

the class KoreAIBridgeFactoryImpl method symphonyAPIInstance.

public ApiInstance symphonyAPIInstance(KoreAIInstanceProperties props) {
    try {
        SymphonyIdentity symphonyBotIdentity = IdentityProperties.instantiateIdentityFromDetails(rl, props.getSymphonyBot(), om);
        TrustManager[] tms = tmf == null ? null : tmf.getTrustManagers();
        ApiInstance apiInstance = apiInstanceFactory.createApiInstance(symphonyBotIdentity, podProperties, tms);
        LOG.info("Constructed API Factory for {} ", props.getName());
        return apiInstance;
    } catch (Exception e) {
        LOG.error("Couldn't create API instance for {} ", props.getName());
        throw new UnsupportedOperationException("Couldn't get api instance: ", e);
    }
}
Also used : SymphonyIdentity(com.symphony.api.id.SymphonyIdentity) ApiInstance(org.finos.symphony.toolkit.spring.api.factories.ApiInstance) IOException(java.io.IOException) TrustManager(javax.net.ssl.TrustManager)

Aggregations

SymphonyIdentity (com.symphony.api.id.SymphonyIdentity)12 IdentityConfigurationException (com.symphony.api.id.IdentityConfigurationException)2 AuthenticationApi (com.symphony.api.login.AuthenticationApi)2 AuthenticateRequest (com.symphony.api.model.AuthenticateRequest)2 Token (com.symphony.api.model.Token)2 IOException (java.io.IOException)2 Date (java.util.Date)2 HashMap (java.util.HashMap)2 ApiInstance (org.finos.symphony.toolkit.spring.api.factories.ApiInstance)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 MethodSource (org.junit.jupiter.params.provider.MethodSource)2 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)2 Bean (org.springframework.context.annotation.Bean)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ApiBuilder (com.symphony.api.bindings.ApiBuilder)1 ConfigurableApiBuilder (com.symphony.api.bindings.ConfigurableApiBuilder)1 CXFApiBuilder (com.symphony.api.bindings.cxf.CXFApiBuilder)1 P12SymphonyIdentity (com.symphony.api.id.P12SymphonyIdentity)1 PemSymphonyIdentity (com.symphony.api.id.PemSymphonyIdentity)1 SingleSymphonyIdentity (com.symphony.api.id.SingleSymphonyIdentity)1