code: @Nullable
      public final Credentials toCredentials(final AuthScope authscope) {
          try {
  
              if (!matches(MatchInfo.fromAuthScope(authscope))) {
                  return null;
              }
          } catch (UnknownHostException | MalformedURLException | SocketException e) {
              throw new RuntimeException(e);
          }
          if (this.username == null) {
              return null;
          }
  
          final String passwordString;
          if (this.password != null) {
              passwordString = new String(this.password);
          } else {
              passwordString = null;
          }
          return new UsernamePasswordCredentials(this.username, passwordString);
      }
docs: Check if this applies to the provided authorization scope and return the credentials for that scope or
  null if it doesn't apply to the scope.
  
  @param authscope the scope to test against.