getBasicPassword method

String getBasicPassword()

Extracts the password from a Basic authentication value.

For Basic authentication, the value is typically in the format 'username:password'. This method returns the password part of the Basic authentication value.

Returns an empty string if the value does not contain a username and password.

Implementation

String getBasicPassword() {
  var arr = value.split(':');
  if (arr.length >= 2) {
    return arr[1];
  }

  return '';
}