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);
}
Aggregations