pkqsunfly
pkqsunfly
采纳率100%
2017-07-12 10:44 阅读 1.6k
已采纳

LR 录制cas sso 单击登录

100

图片说明]
登录脚本时,接口的变化如附图所示。
LR录制的脚本如下
web_submit_data("login;{myCookies}-n1",
"Action=http://rzcloud.shhyit.com:8190/cas/login;jsessionid={myCookies}-n1?service=http://hycloud.shhyit.com:8195/portal_main/toPortalPage",
"Method=POST",
"RecContentType=text/html",
"Referer=http://rzcloud.shhyit.com:8190/cas/login?service=http://hycloud.shhyit.com:8195/portal_main/toPortalPage",
"Snapshot=t13.inf",
"Mode=HTTP",
ITEMDATA,
"Name=username", "Value=jiu23", ENDITEM,
"Name=password", "Value=111111", ENDITEM,
"Name=authCode", "Value=", ENDITEM,
"Name=lt", "Value={ITURL}", ENDITEM,
"Name=execution", "Value=e1s1", ENDITEM,
"Name=_eventId", "Value=submit", ENDITEM,
"Name=isQrSubmit", "Value=false", ENDITEM,
// "Name=qrValue", "Value=3005957d5f8b4f1fa2f9860af015c9db", ENDITEM,
LAST);

增加了重定向内容
web_set_option("MaxRedirectionDepth", "0", LAST );

web_url("getLocation1",
         "URL=http://hycloud.shhyit.com:8195/portal_main/toPortalPage?ticket={ITURL}",                  //此处URL已做参数化
         "TargetFrame=",
 "Resource=0",
 "Referer=http://rzcloud.shhyit.com:8190/cas/login?service=http://hycloud.shhyit.com:8195/portal_main/toPortalPage",
LAST);

但是报错:
Error -26628: HTTP Status-Code=403 (Forbidden) for "http://hycloud.shhyit.com:8195/portal_main/toPortalPage?ticket=LT-624-7qFRVBPxFVS1hvVajGrfNxyNhrxiEr-http://10.103.100.41:8091/cas"

图片说明

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    pkqsunfly pkqsunfly 2017-07-31 02:36

    http 302 问题的解决:
    ////////////////////////////////////////////////////////////////////////////////////////
    //TGT
    //
    web_set_option("MaxRedirectionDepth", "0", LAST );
    /*
    web_save_header(REQUEST, "RequestHeader");
    web_save_header(RESPONSE, "ResponseHeader");
    web_reg_save_param("ResponseBody", "LB=", "RB=", "Search=Body","NotFound=WARNING", LAST);
    */
    lr_end_transaction("login1", LR_AUTO);

    b64_decode_string( lr_eval_string("{TGT}"), "Test" );// 解码
    lr_output_message("解码结果: \nNotify:\t%s", lr_eval_string("{Test}" ));
    
    
    
    
    
    lr_start_transaction("login2");
    
    
    web_add_cookie("usertgt=VEdULTQ0MS1sc2Z1Q1B0UXRCT0VtdGJSMDNKRnlZRlM2U0tWb3Z4MTBFSFRnTmtkWTRNbmRmNFFnVS1odHRwOi8vMTAuMTAzLjEwMC40MTo4MDkxL2Nhcw%3D%3D; DOMAIN=hycloud.shhyit.com");
    
    web_reg_save_param("cRedirectUrlAAA", 
              "LB=Location: ", 
              "RB=\r\n", 
              "Search=Headers", 
              "notfound=warning", 
              LAST);
    
    
    web_add_header("Accept", 
        "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
    
    web_url("login", 
        "URL=http://rzcloud.shhyit.com:8190/cas/login?service=http://hycloud.shhyit.com:8195/%2FPersonalApplications%2FviewPage%3Factive_nav_num%3D1&CTgtId={Test}", 
        "Resource=0", 
        "RecContentType=text/html", 
        "Referer=http://hycloud.shhyit.com:8195/portal_main/toPortalPage", 
        "Snapshot=t35.inf", 
        "Mode=HTTP", 
        LAST);
    
    
    
    /*
    lr_output_message("# 请求头login\n %s", lr_eval_string("{RequestHeader}"));
    lr_output_message("返回头表login\n%s", lr_eval_string("{ResponseHeader}"));
    lr_output_message("返回http内容login\n%s", lr_eval_string("{ResponseBody}"));
    */
    
    
        ///////////////////////////////////////////////////////////////////////
    

    //personAPP+1
    /*
    web_save_header(REQUEST, "RequestHeader");
    web_save_header(RESPONSE, "ResponseHeader");
    web_reg_save_param("ResponseBody", "LB=", "RB=", "Search=Body","NotFound=WARNING", LAST);
    */
    web_reg_save_param("cRedirectUrlBBB",
    "LB=Location: ",
    "RB=\r\n",
    "Search=Headers",
    "notfound=warning",
    LAST);

    web_url("/portal_main/toPortalPage",
    "URL={cRedirectUrlAAA}",
    // "Resource=1",
    // "Referer=http://rzcloud.shhyit.com:8190/cas/login?service=http://hycloud.shhyit.com:8195/portal_main/toPortalPage",
    "Mode=HTML",
    LAST);

    /*
    lr_output_message("# 请求头personAPP+1\n %s", lr_eval_string("{RequestHeader}"));
    lr_output_message("返回头表personAPP+1\n%s", lr_eval_string("{ResponseHeader}"));
    lr_output_message("返回http内容personAPP+1\n%s", lr_eval_string("{ResponseBody}"));
    
    */
    

    //////////////////////////////////////////////////////////////////////////////////////////
    //personAPP+2

    /*
    web_save_header(REQUEST, "RequestHeader");
    web_save_header(RESPONSE, "ResponseHeader");
    web_reg_save_param("ResponseBody", "LB=", "RB=", "Search=Body","NotFound=WARNING", LAST);
    */

    web_url("/portal_main/toPortalPage",
    "URL={cRedirectUrlBBB}",
    // "Resource=1",
    // "Referer=http://rzcloud.shhyit.com:8190/cas/login?service=http://hycloud.shhyit.com:8195/portal_main/toPortalPage",
    "Mode=HTML",
    LAST);

    /*
    lr_output_message("# 请求头personAPP+2\n %s", lr_eval_string("{RequestHeader}"));
    lr_output_message("返回头表personAPP+2\n%s", lr_eval_string("{ResponseHeader}"));
    lr_output_message("返回http内容personAPP+2\n%s", lr_eval_string("{ResponseBody}"));
    */

    //////////////////////////////////////////////////////////////////////////////////////////

    以上的问题,除了302的问题,还因为录取脚本的是中间地址导致的。但是这个坑,没有普遍意义,就不简述了

    点赞 评论 复制链接分享

相关推荐