com.smartbear.readyapi.client.auth.BasicAuthenticationBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ready-api-testserver-client Show documentation
Show all versions of ready-api-testserver-client Show documentation
Java client library for creating and executing test recipes against Ready!API TestServer
The newest version!
package com.smartbear.readyapi.client.auth;
import com.smartbear.readyapi.client.model.Authentication;
import static com.smartbear.readyapi.client.Validator.validateNotEmpty;
public class BasicAuthenticationBuilder implements AuthenticationBuilder {
protected Authentication authentication = new Authentication();
public BasicAuthenticationBuilder(String username, String password) {
authentication.setUsername(username);
authentication.setPassword(password);
}
@Override
public Authentication build() {
validateNotEmpty(authentication.getUsername(), "Missing username, it's a required parameter for Basic Auth.");
validateNotEmpty(authentication.getPassword(), "Missing password, it's a required parameter for Basic Auth.");
authentication.setType("Basic");
return authentication;
}
}