Search in sources :

Example 1 with Authenticator

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

the class DelegatingAuthenticatorFactoryTest method getAuthenticatorForSessionAuthType.

@Test
void getAuthenticatorForSessionAuthType() {
    Authenticator authenticator = DelegatingAuthenticatorFactory.getAuthenticator("test", getServicePropsWithAuthType(Authenticator.PROPNAME_AUTH_TYPE, "COUCHDB_SESSION"));
    assertTrue(authenticator instanceof CouchDbSessionAuthenticator, "Should return an " + "instance of CouchDbSessionAuthenticator");
}
Also used : CouchDbSessionAuthenticator(com.ibm.cloud.cloudant.security.CouchDbSessionAuthenticator) Authenticator(com.ibm.cloud.sdk.core.security.Authenticator) CouchDbSessionAuthenticator(com.ibm.cloud.cloudant.security.CouchDbSessionAuthenticator) Test(org.testng.annotations.Test)

Example 2 with Authenticator

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

the class DelegatingAuthenticatorFactoryTest method getAuthenticatorForSessionAuthTypeAlias.

@Test
void getAuthenticatorForSessionAuthTypeAlias() {
    Authenticator authenticator = DelegatingAuthenticatorFactory.getAuthenticator("test", getServicePropsWithAuthType("AUTHTYPE", "COUCHDB_SESSION"));
    assertTrue(authenticator instanceof CouchDbSessionAuthenticator, "Should return an " + "instance of CouchDbSessionAuthenticator");
}
Also used : CouchDbSessionAuthenticator(com.ibm.cloud.cloudant.security.CouchDbSessionAuthenticator) Authenticator(com.ibm.cloud.sdk.core.security.Authenticator) CouchDbSessionAuthenticator(com.ibm.cloud.cloudant.security.CouchDbSessionAuthenticator) Test(org.testng.annotations.Test)

Example 3 with Authenticator

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

the class CouchDbSessionAuthenticatorTest method validateNullUser.

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

Example 4 with Authenticator

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

the class CouchDbSessionAuthenticatorTest method validateEmptyUser.

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

Example 5 with Authenticator

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

the class CompareComplyServiceTest method setUp.

/*
   * (non-Javadoc)
   * @see com.ibm.watson.common.WatsonServiceTest#setUp()
   */
@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    String apiKey = System.getenv("COMPARE_COMPLY_APIKEY");
    Assume.assumeFalse("COMPARE_COMPLY_APIKEY is not defined", apiKey == null);
    Authenticator authenticator = new IamAuthenticator(apiKey);
    service = new CompareComply(VERSION, authenticator);
    service.setServiceUrl(System.getenv("COMPARE_COMPLY_URL"));
    service.setDefaultHeaders(getDefaultHeaders());
}
Also used : IamAuthenticator(com.ibm.cloud.sdk.core.security.IamAuthenticator) Authenticator(com.ibm.cloud.sdk.core.security.Authenticator) IamAuthenticator(com.ibm.cloud.sdk.core.security.IamAuthenticator) Before(org.junit.Before)

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