All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aeontronix.enhancedmule.tools.emclient.authentication.CredentialsProviderAccessTokenImpl Maven / Gradle / Ivy

There is a newer version: 2.0.0-alpha4
Show newest version
/*
 * Copyright (c) Aeontronix 2021
 */

package com.aeontronix.enhancedmule.tools.emclient.authentication;

import com.aeontronix.enhancedmule.tools.authentication.AccessTokenCredentials;
import com.aeontronix.enhancedmule.tools.authentication.Credentials;
import com.aeontronix.enhancedmule.tools.emclient.EnhancedMuleClient;

import java.io.IOException;

public class CredentialsProviderAccessTokenImpl implements AnypointBearerTokenCredentialsProvider {
    private String tokenId;
    private String tokenSecret;

    public CredentialsProviderAccessTokenImpl(String tokenId, String tokenSecret) {
        this.tokenId = tokenId;
        this.tokenSecret = tokenSecret;
    }

    @Override
    public Credentials getCredentials() throws IOException {
        return new AccessTokenCredentials(tokenId, tokenSecret);
    }

    @Override
    public String getAnypointBearerToken(EnhancedMuleClient restClient) throws IOException {
        return restClient.getRestClient().get("/anypoint/bearer").execute(String.class);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy