Search in sources :

Example 46 with Authenticator

use of com.ibm.cloud.sdk.core.security.Authenticator in project cloudant-java-sdk by IBM.

the class CouchDbSessionAuthenticatorTest method newAuthenticator.

@Test
void newAuthenticator() {
    Authenticator authenticator = createAuthenticator(USERNAME, PASSWORD);
    assertNotNull(authenticator, "Authenticator should not be null.");
}
Also used : Authenticator(com.ibm.cloud.sdk.core.security.Authenticator) Test(org.testng.annotations.Test)

Example 47 with Authenticator

use of com.ibm.cloud.sdk.core.security.Authenticator in project cloudant-java-sdk by IBM.

the class CouchDbSessionAuthenticatorTest method validateEmptyPass.

@Test
void validateEmptyPass() {
    Authenticator a = createAuthenticator(CouchDbSessionAuthenticatorTest.USERNAME, "");
    assertThrows(IllegalArgumentException.class, a::validate);
}
Also used : Authenticator(com.ibm.cloud.sdk.core.security.Authenticator) Test(org.testng.annotations.Test)

Example 48 with Authenticator

use of com.ibm.cloud.sdk.core.security.Authenticator in project cloudant-java-sdk by IBM.

the class CouchDbSessionAuthenticatorTest method validateNullPass.

@Test
void validateNullPass() {
    Authenticator a = createAuthenticator(CouchDbSessionAuthenticatorTest.USERNAME, null);
    assertThrows(IllegalArgumentException.class, a::validate);
}
Also used : Authenticator(com.ibm.cloud.sdk.core.security.Authenticator) Test(org.testng.annotations.Test)

Example 49 with Authenticator

use of com.ibm.cloud.sdk.core.security.Authenticator in project cloudant-java-sdk by IBM.

the class Cloudant method newInstance.

/**
 * Class method which constructs an instance of the `Cloudant` client.
 * The specified service name is used to configure the client instance.
 *
 * @param serviceName the service name to be used when configuring the client instance
 * @return an instance of the `Cloudant` client using external configuration
 */
public static Cloudant newInstance(String serviceName) {
    Authenticator authenticator = com.ibm.cloud.cloudant.internal.DelegatingAuthenticatorFactory.getAuthenticator(serviceName);
    Cloudant service = new Cloudant(serviceName, authenticator);
    service.configureService(serviceName);
    return service;
}
Also used : Authenticator(com.ibm.cloud.sdk.core.security.Authenticator)

Example 50 with Authenticator

use of com.ibm.cloud.sdk.core.security.Authenticator in project java-sdk by watson-developer-cloud.

the class ToneAnalyzerTest method constructClientService.

public void constructClientService() throws Throwable {
    final String serviceName = "testService";
    // set mock values for global params
    String version = "testString";
    final Authenticator authenticator = new NoAuthAuthenticator();
    toneAnalyzerService = new ToneAnalyzer(version, serviceName, authenticator);
    String url = server.url("/").toString();
    toneAnalyzerService.setServiceUrl(url);
}
Also used : NoAuthAuthenticator(com.ibm.cloud.sdk.core.security.NoAuthAuthenticator) Authenticator(com.ibm.cloud.sdk.core.security.Authenticator) NoAuthAuthenticator(com.ibm.cloud.sdk.core.security.NoAuthAuthenticator)

Aggregations

Authenticator (com.ibm.cloud.sdk.core.security.Authenticator)58 IamAuthenticator (com.ibm.cloud.sdk.core.security.IamAuthenticator)32 Before (org.junit.Before)15 NoAuthAuthenticator (com.ibm.cloud.sdk.core.security.NoAuthAuthenticator)14 Test (org.testng.annotations.Test)8 SpeechRecognitionResults (com.ibm.watson.speech_to_text.v1.model.SpeechRecognitionResults)5 BasicAuthenticator (com.ibm.cloud.sdk.core.security.BasicAuthenticator)4 BearerTokenAuthenticator (com.ibm.cloud.sdk.core.security.BearerTokenAuthenticator)4 File (java.io.File)4 InputStream (java.io.InputStream)4 CouchDbSessionAuthenticator (com.ibm.cloud.cloudant.security.CouchDbSessionAuthenticator)3 HttpConfigOptions (com.ibm.cloud.sdk.core.http.HttpConfigOptions)3 Response (com.ibm.cloud.sdk.core.http.Response)2 MessageInput (com.ibm.watson.assistant.v1.model.MessageInput)2 MessageOptions (com.ibm.watson.assistant.v1.model.MessageOptions)2 MessageResponse (com.ibm.watson.assistant.v1.model.MessageResponse)2 WatsonServiceTest (com.ibm.watson.common.WatsonServiceTest)2 TranslateOptions (com.ibm.watson.language_translator.v3.model.TranslateOptions)2 TranslationResult (com.ibm.watson.language_translator.v3.model.TranslationResult)2 RecognizeWithWebsocketsOptions (com.ibm.watson.speech_to_text.v1.model.RecognizeWithWebsocketsOptions)2