use of com.symphony.api.model.ExtensionAppAuthenticateRequest in project spring-bot by finos.
the class PodInfoStoreTokenStrategy method certBasedRequest.
@Override
protected ExtensionAppTokens certBasedRequest(String appToken, PodInfo pod) throws Exception {
ApiBuilder ab = setupApiBuilder(pod, pod.getPayload().getSessionAuthUrl());
CertificateAuthenticationApi aa = ab.getApi(CertificateAuthenticationApi.class);
ExtensionAppAuthenticateRequest ar = new ExtensionAppAuthenticateRequest();
ar.setAppToken(appToken);
ExtensionAppTokens out = aa.v1AuthenticateExtensionAppPost(ar);
return out;
}
use of com.symphony.api.model.ExtensionAppAuthenticateRequest in project spring-bot by finos.
the class PodAuthControllerByFileTest method testAuthentication.
@Test
public void testAuthentication() throws Exception {
Mockito.when(abf.getObject()).thenReturn(new AbstractApiBuilder() {
@SuppressWarnings("unchecked")
@Override
public <X> X getApi(Class<X> c) {
Assertions.assertEquals("https://your.pod.domain:8444/sessionauth", this.url);
Assertions.assertEquals(CertificateAuthenticationApi.class, c);
Assertions.assertEquals("myproxy.com", this.proxyHost);
return (X) authApi;
}
});
Mockito.when(authApi.v1AuthenticateExtensionAppPost(Mockito.any())).thenAnswer(i -> {
ExtensionAppAuthenticateRequest ar = (ExtensionAppAuthenticateRequest) i.getArgument(0);
return new ExtensionAppTokens().appId("appid123").appToken(ar.getAppToken()).symphonyToken("Sym123");
});
this.mockMvc.perform(get("/symphony-app/podAuth?podId=9999").contentType(MediaType.APPLICATION_JSON)).andDo(print()).andExpect(jsonPath("$.appId", containsString("appid123"))).andExpect(jsonPath("$.tokenA", containsString("someAppId/"))).andExpect(status().isOk());
}
use of com.symphony.api.model.ExtensionAppAuthenticateRequest 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;
}
use of com.symphony.api.model.ExtensionAppAuthenticateRequest in project spring-bot by finos.
the class PodAuthControllerByConfigTest method testAuthentication.
@Test
public void testAuthentication() throws Exception {
Mockito.when(abf.getObject()).thenReturn(new AbstractApiBuilder() {
@SuppressWarnings("unchecked")
@Override
public <X> X getApi(Class<X> c) {
Assertions.assertEquals("http://blah.com/sessionauth", this.url);
Assertions.assertEquals(CertificateAuthenticationApi.class, c);
return (X) authApi;
}
});
Mockito.when(authApi.v1AuthenticateExtensionAppPost(Mockito.any())).thenAnswer(i -> {
ExtensionAppAuthenticateRequest ar = (ExtensionAppAuthenticateRequest) i.getArgument(0);
return new ExtensionAppTokens().appId("appid123").appToken(ar.getAppToken()).symphonyToken("Sym123");
});
this.mockMvc.perform(get("/symphony-app/podAuth?podId=666").contentType(MediaType.APPLICATION_JSON)).andDo(print()).andExpect(jsonPath("$.appId", containsString("appid123"))).andExpect(jsonPath("$.tokenA", containsString("someAppId/"))).andExpect(status().isOk());
}
Aggregations