简体   繁体   English

在java中用Scoop 3设置一个cookie域

[英]set a cookie domain in Scoop of 3 in java

I have a problem with the cookie domain I am using in .mydomain.net and I would like to have it in a scoop of 3 so it would be .app.mydomain.net So I have this: 我在.mydomain.net中使用的cookie域有问题,我想在3的勺子中有它,所以它会是.app.mydomain.net所以我有这个:

    // Save siteminder cookie from a login succes and redirect to target application url
            log.debug("Certificate type: "+ s_certificateType );
            log.debug("Application Authentication Level: "+ s_authLevel );
            if ( s_certificateType.length() == 0 || s_certificateType.equals ("HARD") || ( s_certificateType.equals ("SOFT") && ( s_authLevel.equals("1") || s_authLevel.equals("2") ) ) ) {
                Cookie c_cookie = new Cookie ("SSOHUBSESSION", s_sessionToken );
                c_cookie.setDomain(application.getInitParameter("domain"));
                response.addCookie ( c_cookie );                
                log.debug("REDIRECT: "+ s_returnurl );
                                        session.invalidate();
                Cookie[] a_cookies = request.getCookies();
                if (a_cookies != null) {
                    for (int i = 0; i < a_cookies.length; i++)
                    {
                        if (a_cookies[i].getName().equals("SSOHUBFED_OLD_SESSION") ) {
                            log.debug("Update the SSOHUBFED_OLD_SESSION with the new Session. ");
                            c_cookie = new Cookie("SSOHUBFED_OLD_SESSION", s_sessionToken);
                            c_cookie.setDomain(application.getInitParameter("domain"));
                            //c_cookie.setMaxAge(0);
                            c_cookie.setValue(s_sessionToken);
                            response.addCookie(c_cookie);
                        }
                    }

                }


                response.sendRedirect(s_returnurl);
                return;
            }
        }

Here I was thinking to just add in the end response.addCookie(".app."+c_cookie); 在这里,我想在最后添加response.addCookie(“。app。”+ c_cookie); I don't know maybe there is a way to get direcly the scoop of 3 or something!!! 我不知道是否有办法直接获得3或者其他东西! Does anyone have an idea of how I can Do that ? 有谁知道我怎么做? Thank you for your help. 谢谢您的帮助。

I'm not sure I follow what you're trying to do in the code, but in SiteMinder (aka CA SSO) the cookie domain scope is defined in the Agent Configuration Object. 我不确定我是否遵循您在代码中尝试执行的操作,但在SiteMinder(也称为CA SSO)中,Cookie域范围在代理配置对象中定义。 Also there will be a request header called SM_SDOMAIN or SMSDOMAIN (underscore may or may not be present, also depends on ACO settings) that contains the exact cookie domain that SiteMinder is using, eg 此外,还会有一个名为SM_SDOMAIN或SMSDOMAIN的请求标头(下划线可能存在,也可能不存在,也取决于ACO设置),其中包含SiteMinder正在使用的确切cookie域,例如

String smcookiedomain = request.getHeader("SM_SDOMAIN");

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM