Package fi.bitwards.service
Class BitwardsCredential.Builder
java.lang.Object
fi.bitwards.service.BitwardsCredential.Builder
- Enclosing class:
BitwardsCredential
Builder class to build Credential instance.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the BitwardsCredential instance for given parameters.setAuthenticationDomain(String authenticationDomain) Set the authentication domain of the BitwardsCredential.setAuthenticationToken(String authenticationToken) Set the authentication token or authorization code of the BitwardsCredential.setGrantType(String grantType) Set the (optional) grant type of the BitwardsCredential.setPassword(String password) Set the password of the BitwardsCredential.setRedirectUri(String redirectUri) Set the (optional) redirect URI that was used when obtaining the authentication token or authorization code.setRefreshToken(String refreshToken) Set the (optional) refresh token of the BitwardsCredential.setUsername(String username) Set the username of the BitwardsCredential.
-
Constructor Details
-
Builder
public Builder(int type) Constructor for Builder instance- Parameters:
type- determines the type of the BitwardsCredential
-
-
Method Details
-
setUsername
Set the username of the BitwardsCredential. BitwardsCredential type has to beBitwardsCredential.TYPE_USERNAME_PASSWORD.- Parameters:
username- the username of end user- Returns:
-
setPassword
Set the password of the BitwardsCredential. BitwardsCredential type has to beBitwardsCredential.TYPE_USERNAME_PASSWORD.- Parameters:
password- the password of end user- Returns:
-
setAuthenticationToken
Set the authentication token or authorization code of the BitwardsCredential. BitwardsCredential type has to beBitwardsCredential.TYPE_OAUTH2_AUTH_TOKEN.- Parameters:
authenticationToken- the authentication token- Returns:
-
setAuthenticationDomain
Set the authentication domain of the BitwardsCredential. BitwardsCredential type has to beBitwardsCredential.TYPE_OAUTH2_AUTH_TOKEN.- Parameters:
authenticationDomain- the authentication domain- Returns:
-
setRefreshToken
Set the (optional) refresh token of the BitwardsCredential. BitwardsCredential type has to beBitwardsCredential.TYPE_OAUTH2_AUTH_TOKEN.- Parameters:
refreshToken- the refresh token- Returns:
-
setGrantType
Set the (optional) grant type of the BitwardsCredential. BitwardsCredential type has to beBitwardsCredential.TYPE_OAUTH2_AUTH_TOKEN.- Parameters:
grantType- the grant type- Returns:
-
setRedirectUri
Set the (optional) redirect URI that was used when obtaining the authentication token or authorization code. This is typically required when the backend is using the refreshToken to obtain a new authetication token, or when the authorization code is used.- Parameters:
redirectUri-- Returns:
-
build
Builds the BitwardsCredential instance for given parameters.- Returns:
- the BitwardsCredential instance
- Throws:
BitwardsException- is thrown if an error occurs during building process.
-