Class ClientAuthentication
- java.lang.Object
-
- co.elasticsearch.enterprisesearch.client.ClientAuthentication
-
public class ClientAuthentication extends Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetPassword()Optional, if using BASIC authentication this is the passwordStringgetToken()Optional, Either an API Key or Elasticsearch tokensStringgetUsername()Optional, if using BASIC authentication this is the usernamestatic ClientAuthenticationwithBasicAuth(String username, String password)Create an authentication object using username and password authenticationstatic ClientAuthenticationwithBearerAuth(String token)Create an authentication object using a bearer token
-
-
-
Method Detail
-
withBearerAuth
public static ClientAuthentication withBearerAuth(String token)
Create an authentication object using a bearer token- Parameters:
token- The token value. Generally starts with 'private-' or 'search-'- Returns:
- A token based ClientAuthentication
-
withBasicAuth
public static ClientAuthentication withBasicAuth(String username, String password)
Create an authentication object using username and password authentication- Parameters:
username- the usernamepassword- the password- Returns:
- A client authentication object
-
getUsername
public String getUsername()
Optional, if using BASIC authentication this is the username- Returns:
- The username
-
getPassword
public String getPassword()
Optional, if using BASIC authentication this is the password- Returns:
- the password
-
getToken
public String getToken()
Optional, Either an API Key or Elasticsearch tokens- Returns:
- The API Key or token
-
-