public static String fillInBasicAuthInfo(BaseConfigType config,String locationURL){
  if (config == null) {
    return locationURL;
  }
  Map map=SAML2MetaUtils.getAttributes(config);
  List baoList=(List)map.get(SAML2Constants.BASIC_AUTH_ON);
  if (baoList == null || baoList.isEmpty()) {
    return locationURL;
  }
  String on=(String)baoList.get(0);
  if (on == null) {
    return locationURL;
  }
  on=on.trim();
  if (on.length() == 0 || !on.equalsIgnoreCase("true")) {
    return locationURL;
  }
  List ul=(List)map.get(SAML2Constants.BASIC_AUTH_USER);
  if (ul == null || ul.isEmpty()) {
    return locationURL;
  }
  String u=(String)ul.get(0);
  if (u == null) {
    return locationURL;
  }
  u=u.trim();
  if (u.length() == 0) {
    return locationURL;
  }
  List pl=(List)map.get(SAML2Constants.BASIC_AUTH_PASSWD);
  String p=null;
  if (pl != null && !pl.isEmpty()) {
    p=(String)pl.get(0);
  }
  if (p == null) {
    p="";
  }
  String dp=SAMLUtilsCommon.decodePassword(p);
  int index=locationURL.indexOf("//");
  return locationURL.substring(0,index + 2) + u + ":"+ dp+ "@"+ locationURL.substring(index + 2);
}

public static String fillInBasicAuthInfo ( BaseConfigType config , String locationURL ) { if ( config == null ) { return locationURL ; } Map map = SAML2MetaUtils . getAttributes ( config ) ; List baoList = ( List ) map . get ( SAML2Constants . BASIC_AUTH_ON ) ; if ( baoList == null || baoList . isEmpty ( ) ) { return locationURL ; } String on = ( String ) baoList . get ( 0 ) ; if ( on == null ) { return locationURL ; } on = on . trim ( ) ; if ( on . length ( ) == 0 || ! on . equalsIgnoreCase ( "true" ) ) { return locationURL ; } List ul = ( List ) map . get ( SAML2Constants . BASIC_AUTH_USER ) ; if ( ul == null || ul . isEmpty ( ) ) { return locationURL ; } String u = ( String ) ul . get ( 0 ) ; if ( u == null ) { return locationURL ; } u = u . trim ( ) ; if ( u . length ( ) == 0 ) { return locationURL ; } List pl = ( List ) map . get ( SAML2Constants . BASIC_AUTH_PASSWD ) ; String p = null ; if ( pl != null && ! pl . isEmpty ( ) ) { p = ( String ) pl . get ( 0 ) ; } if ( p == null ) { p = "" ; } String dp = SAMLUtilsCommon . decodePassword ( p ) ; int index = locationURL . indexOf ( "//" ) ; return locationURL . substring ( 0 , index + 2 ) + u + ":" + dp + "@" + locationURL . substring ( index + 2 ) ; }
fills in basic auth user and password inside the location url if configuration is done properly
