Search in sources :

Example 1 with Token

use of com.symphony.api.model.Token in project spring-bot by finos.

the class RSAAuthIT method testKeyManagerAuthWithRSA.

@ParameterizedTest
@MethodSource("setupConfigurations")
public void testKeyManagerAuthWithRSA(TestClientStrategy s) throws Exception {
    SymphonyIdentity id = s.getIdentity();
    String jwt = JWTHelper.createSignedJwt(id.getCommonName(), id.getPrivateKey());
    AuthenticationApi keyApi = s.getRSAKeyAuthApi();
    AuthenticateRequest req = new AuthenticateRequest();
    req.setToken(jwt);
    Token done = keyApi.pubkeyAuthenticatePost(req);
    System.out.println(done);
}
Also used : AuthenticationApi(com.symphony.api.login.AuthenticationApi) AuthenticateRequest(com.symphony.api.model.AuthenticateRequest) SymphonyIdentity(com.symphony.api.id.SymphonyIdentity) Token(com.symphony.api.model.Token) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 2 with Token

use of com.symphony.api.model.Token in project spring-bot by finos.

the class RSAAuthIT method testSessionAuthWithRSA.

@ParameterizedTest
@MethodSource("setupConfigurations")
public void testSessionAuthWithRSA(TestClientStrategy s) throws Exception {
    SymphonyIdentity id = s.getIdentity();
    String jwt = JWTHelper.createSignedJwt(id.getCommonName(), id.getPrivateKey());
    System.out.println(jwt);
    System.out.println(JWTHelper.decodeJwt(jwt));
    AuthenticationApi sessionApi = s.getRSASessionAuthApi();
    AuthenticateRequest req = new AuthenticateRequest();
    req.setToken(jwt);
    Token done = sessionApi.pubkeyAuthenticatePost(req);
    System.out.println(done);
}
Also used : AuthenticationApi(com.symphony.api.login.AuthenticationApi) AuthenticateRequest(com.symphony.api.model.AuthenticateRequest) SymphonyIdentity(com.symphony.api.id.SymphonyIdentity) Token(com.symphony.api.model.Token) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 3 with Token

use of com.symphony.api.model.Token in project spring-bot by finos.

the class SymphonyMessageSender method jwtAuth.

private Token jwtAuth(ApiBuilder apiBuilder) {
    try {
        String token = JWTHelper.createSignedJwt(id.getCommonName(), id.getPrivateKey());
        AuthenticateRequest ar = new AuthenticateRequest().token(token);
        Token out = apiBuilder.getApi(com.symphony.api.login.AuthenticationApi.class).pubkeyAuthenticatePost(ar);
        return out;
    } catch (Exception e) {
        throw new RuntimeException("Couldn't auth with jwt", e);
    }
}
Also used : AuthenticateRequest(com.symphony.api.model.AuthenticateRequest) CertificateAuthenticationApi(com.symphony.api.authenticator.CertificateAuthenticationApi) Token(com.symphony.api.model.Token) IOException(java.io.IOException)

Aggregations

AuthenticateRequest (com.symphony.api.model.AuthenticateRequest)3 Token (com.symphony.api.model.Token)3 SymphonyIdentity (com.symphony.api.id.SymphonyIdentity)2 AuthenticationApi (com.symphony.api.login.AuthenticationApi)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 MethodSource (org.junit.jupiter.params.provider.MethodSource)2 CertificateAuthenticationApi (com.symphony.api.authenticator.CertificateAuthenticationApi)1 IOException (java.io.IOException)1