code: @SuppressWarnings("unchecked")
      protected Credentials getCredentials(Map<String, String> credentials) {
          Credentials credential = null;
          if (credentials != null && credentials.containsKey(getCredentialKey())) {
              try {
                  byte[] credBytes = DatatypeConverter.parseBase64Binary(credentials.get(getCredentialKey()));
                  ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(credBytes));
  
                  credential = new Credentials();
                  credential.readFields(in);
              } catch (Exception e) {
                  LOG.error("Could not obtain credentials from credentials map.", e);
              }
          }
          return credential;
      }
docs: /*
  
  @param credentials map with creds.
  @return instance of org.apache.hadoop.security.Credentials.
  this class's populateCredentials must have been called before.