Search in sources :

Example 1 with StaticCredentialsProvider

use of com.amazonaws.kinesisvideo.auth.StaticCredentialsProvider in project aws-sdk-android by aws-amplify.

the class DefaultServiceCallbacksImpl method getCredentialsProvider.

@Nullable
protected static KinesisVideoCredentialsProvider getCredentialsProvider(@Nullable final byte[] authData, @NonNull final Log log) {
    if (null == authData) {
        log.warn("NULL credentials have been returned by the credentials provider.");
        return null;
    }
    // De-serialize the bytes into AWSCredentials object
    final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(authData);
    KinesisVideoCredentials credentials = null;
    try {
        final ObjectInput objectInput = new ObjectInputStream(byteArrayInputStream);
        credentials = (KinesisVideoCredentials) objectInput.readObject();
        objectInput.close();
    } catch (final IOException e) {
        log.exception(e);
        return null;
    } catch (final ClassNotFoundException e) {
        log.exception(e);
        return null;
    } finally {
        try {
            byteArrayInputStream.close();
        } catch (final IOException e) {
            log.exception(e);
        }
    }
    // Create a static credentials provider
    return new StaticCredentialsProvider(credentials);
}
Also used : StaticCredentialsProvider(com.amazonaws.kinesisvideo.auth.StaticCredentialsProvider) KinesisVideoCredentials(com.amazonaws.kinesisvideo.auth.KinesisVideoCredentials) Nullable(androidx.annotation.Nullable)

Aggregations

Nullable (androidx.annotation.Nullable)1 KinesisVideoCredentials (com.amazonaws.kinesisvideo.auth.KinesisVideoCredentials)1 StaticCredentialsProvider (com.amazonaws.kinesisvideo.auth.StaticCredentialsProvider)1