org.cloudfoundry.client.lib.adapters.OAuthTokenProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cloudfoundry-client-lib Show documentation
Show all versions of cloudfoundry-client-lib Show documentation
A Cloud Foundry client library for Java
The newest version!
package org.cloudfoundry.client.lib.adapters;
import org.cloudfoundry.client.lib.oauth2.OAuthClient;
import org.cloudfoundry.reactor.ConnectionContext;
import org.cloudfoundry.reactor.TokenProvider;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import reactor.core.publisher.Mono;
public class OAuthTokenProvider implements TokenProvider {
private OAuthClient oAuthClient;
public OAuthTokenProvider(OAuthClient oAuthClient) {
this.oAuthClient = oAuthClient;
}
@Override
public Mono getToken(ConnectionContext connectionContext) {
return Mono.fromSupplier(() -> {
OAuth2AccessToken token = oAuthClient.getToken();
return token.getTokenType() + " " + token.getValue();
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy