public PasswordScopeAccess(JSONObject jsonResponse,String manualToken1,String prefRegion){
  prefferedRegion=prefRegion;
  manualToken=manualToken1;
  JSONObject token=(JSONObject)jsonResponse.get("token");
  JSONArray catalog=(JSONArray)token.get("catalog");
  for (  Object obj : catalog) {
    JSONObject jObj=(JSONObject)obj;
    String name=(String)jObj.get("name");
    String type=(String)jObj.get("type");
    if (name.equals("swift") && type.equals("object-store")) {
      JSONArray endPoints=(JSONArray)jObj.get("endpoints");
      for (      Object endPointObj : endPoints) {
        JSONObject endPoint=(JSONObject)endPointObj;
        String region=(String)endPoint.get("region");
        if (region.equals(prefferedRegion)) {
          String interfaceType=(String)endPoint.get("interface");
          if (interfaceType.equals("public")) {
            publicURL=(String)endPoint.get("url");
          }
 else           if (interfaceType.equals("internal")) {
            internalURL=(String)endPoint.get("url");
          }
        }
      }
    }
  }
}

public PasswordScopeAccess ( JSONObject jsonResponse , String manualToken1 , String prefRegion ) { prefferedRegion = prefRegion ; manualToken = manualToken1 ; JSONObject token = ( JSONObject ) jsonResponse . get ( "token" ) ; JSONArray catalog = ( JSONArray ) token . get ( "catalog" ) ; for ( Object obj : catalog ) { JSONObject jObj = ( JSONObject ) obj ; String name = ( String ) jObj . get ( "name" ) ; String type = ( String ) jObj . get ( "type" ) ; if ( name . equals ( "swift" ) && type . equals ( "object-store" ) ) { JSONArray endPoints = ( JSONArray ) jObj . get ( "endpoints" ) ; for ( Object endPointObj : endPoints ) { JSONObject endPoint = ( JSONObject ) endPointObj ; String region = ( String ) endPoint . get ( "region" ) ; if ( region . equals ( prefferedRegion ) ) { String interfaceType = ( String ) endPoint . get ( "interface" ) ; if ( interfaceType . equals ( "public" ) ) { publicURL = ( String ) endPoint . get ( "url" ) ; } else if ( interfaceType . equals ( "internal" ) ) { internalURL = ( String ) endPoint . get ( "url" ) ; } } } } } }
parse keystone v3 api password scoped authentication
