Class TokenClient
- java.lang.Object
-
- org.apache.pulsar.client.impl.auth.oauth2.protocol.TokenClient
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,ClientCredentialsExchanger
public class TokenClient extends java.lang.Object implements ClientCredentialsExchanger
A client for an OAuth 2.0 token endpoint.
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
DEFAULT_CONNECT_TIMEOUT_IN_SECONDS
protected static int
DEFAULT_READ_TIMEOUT_IN_SECONDS
-
Constructor Summary
Constructors Constructor Description TokenClient(java.net.URL tokenUrl)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
TokenResult
exchangeClientCredentials(ClientCredentialsExchangeRequest req)
Performs a token exchange using client credentials.
-
-
-
Field Detail
-
DEFAULT_CONNECT_TIMEOUT_IN_SECONDS
protected static final int DEFAULT_CONNECT_TIMEOUT_IN_SECONDS
- See Also:
- Constant Field Values
-
DEFAULT_READ_TIMEOUT_IN_SECONDS
protected static final int DEFAULT_READ_TIMEOUT_IN_SECONDS
- See Also:
- Constant Field Values
-
-
Method Detail
-
close
public void close() throws java.lang.Exception
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
java.lang.Exception
-
exchangeClientCredentials
public TokenResult exchangeClientCredentials(ClientCredentialsExchangeRequest req) throws TokenExchangeException, java.io.IOException
Performs a token exchange using client credentials.- Specified by:
exchangeClientCredentials
in interfaceClientCredentialsExchanger
- Parameters:
req
- the client credentials request details.- Returns:
- a token result
- Throws:
TokenExchangeException
java.io.IOException
- if a general IO error occurred.
-
-