Tag: 登录

使用JSOUP登录ConEd网站

我已经广泛阅读了这个和我如何尝试了许多不同的变化,但我无法让它工作。 基本上,我只想登录ConEdison网站并查看我的账单历史记录。 这是我有的: Connection.Response loginForm = Jsoup.connect(“https://apps.coned.com/cemyaccount/NonMemberPages/Login.aspx?lang=eng”) .data(“_LASTFOCUS”,””) .data(“_EVENTTARGET”,””) .data(“_EVENTARGUMENT”,””) .data(“_VIEWSTATE”, viewState) .data(“_EVENTVALIDATION”, eventValidation) .data(“ctl00$Main$Login1$UserName”, username) .data(“ctl00$Main$Login1$Password”, password) .data(“ctl00$Main$Login1$LoginButton”, “Sign In”) .userAgent(“Mozilla/5.0”) .method(Method.POST) .execute(); Map loginCookies = loginForm.cookies(); Document document = Jsoup.connect(“https://apps.coned.com/CEMyAccount/CSOL/BillHistory.aspx?lang=eng”) .cookies(loginCookies) .get(); Elements data = document.select(“table.ctl00_Main_lvBillHistory_Table1”); //checking if it found the right page System.out.println(“document: ” + document); //checking if it found the table […]

使用spring security根据用户ROLES设置自定义的登录后目标

我想在我的应用程序中根据用户ROLES设置自定义的登录后目标。 例如:如果尝试访问受保护资源时未提示表单登录,我希望根据不同角色显示不同页面。 通过使用target-url我无法做到这一点。 我怎么能通过使用Spring安全性来做到这一点?

如何在同一浏览器上重新运行Selenium 2.0(webdriver)测试?

我正在尝试使用Selenium 2.0(Webdriver)来实现一系列测试。 在运行这些测试之前,我必须登录该应用程序。 由于应用程序不是我自己的(测试api构建的function),因此每个测试都不应该登录到我的应用程序中运行。 我更愿意做以下事情: 将我的webdriver测试连接到我的开放式Firefox浏览器(已登录) 使用相同的浏览器运行我的webdriver项目。 据我所知,Selenium通常会为其浏览器分配会话ID。 但是,Selenium 2.0驱动程序的当前Java实现没有使用会话ID(可能确实如此,但我不知道在哪里找到它。) 有人可以提供一些指导如何解决我的问题(现有的浏览器和使用Selenium 2.0(java)运行多个测试)? 提供的任何代码也会有所帮助。 谢谢!

Java中的java.lang.OutOfMemoryError

我想通过java progrram登录ORKUT而不涉及IE或Firefox, 我以下列方式使用HTMLUnit : import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.html.HtmlPasswordInput; import com.gargoylesoftware.htmlunit.html.HtmlTextInput; import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput; public class HtmlUnit { public void submittingForm() throws Exception { final WebClient webClient = new WebClient(); // Get the first page final HtmlPage page1 = webClient.getPage(“https://www.google.com/accounts/ServiceLogin?service=orkut&hl=en-US&rm=false&continue=http%3A%2F%2Fwww.orkut.com%2FRedirLogin%3Fmsg%3D0%26page%3Dhttp%253A%252F%252Fwww.orkut.co.in%252FHome.aspx&cd=IN&passive=true&skipvpage=true&sendvemail=false”); System.out.println(“Page1: ” + page1.toString()); // Get the form that we are dealing with and within […]

Spring-Security:升级到Spring-Security 4.1后,用户名将被发送为空以进行登录

我正在开发基于Spring-MVC的应用程序,我们使用Spring-Security进行登录,授权。 我们之前使用的是版本3.2.5,升级是4.1.1。 升级后,登录机制会因发送的用户名为空而中断。 我不知道出了什么问题。 你能帮忙的话,我会很高兴。 securityApplicationContext.xml: <!—-> <!– –> web.xml: contextConfigLocation /WEB-INF/spring/root-context.xml,/WEB-INF/spring/appServlet/security-applicationContext.xml 2440 org.springframework.web.context.request.RequestContextListener org.springframework.web.context.ContextLoaderListener springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy true contextAttribute org.springframework.web.context.WebApplicationContext.ROOT springSecurityFilterChain /* 调试日志: DEBUG: org.springframework.security.web.util.matcher.AntPathRequestMatcher – Checking match of request : ‘/j_spring_security_check’; against ‘/resources/**’ DEBUG: org.springframework.security.web.FilterChainProxy – /j_spring_security_check at position 1 of 12 in additional filter chain; firing Filter: ‘SecurityContextPersistenceFilter’ DEBUG: org.springframework.security.web.context.HttpSessionSecurityContextRepository – HttpSession returned […]

记住我在jsp登录页面

我有一个login screen ,我通过检查数据库中的凭据来validation用户。 但是我如何实现Remember me check box ? 喜欢在gmail中remember me(stay signed in)存在。 我使用sign.jsp和Auth servlet (doPost)和oracle 10g ee进行身份validation。

用户使用JSF 2.0登录

我正在尝试 – 使用JSF 2.0 – 以一种巧妙的方式实现登录/记住我/注销管理。 由于传统的<form action="j_security_check" …方式缺乏灵活性,我决定采用不同的路径,但我发现了一个问题。 通过在应用程序服务器中以及通过 , 和在web.xml中正确设置声明性安全性。 登录页面: 简单的LoginBean#login(): public String login( ) { HttpServletRequest request = (HttpServletRequest)FacesContext.getCurrentInstance( ).getExternalContext( ).getRequest( ); try { request.login( username, password ); } catch ( ServletException e ) { FacesContext.getCurrentInstance().addMessage( “Unknown login… return null; } return “i_dont_know_where_you_were_going”; } 一切正常,但成功登录后我不知道如何将用户转发到其原始请求。 由于登录页面自动插入客户端请求和“任何”安全资源之间,因此我需要一种方法来了解重定向操作的位置。 request.getRequestURL( )没有帮助,可能是因为RequestDispatcher#forward() (它覆盖了请求url)干预。 您认为这是管理登录过程的合适方式吗? 如果是这样,任何关于这个问题的暗示? […]

会话validationfilter,在会话过期时注销用户

我有一个会话validationfilter,在会话过期时注销用户。 这是一段代码,但这不起作用。 不工作意味着即使会话过期,也不会重定向到登录页面。 请帮我解决这个问题。 public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletResponse res = (HttpServletResponse) response; HttpServletRequest req = (HttpServletRequest) request; HttpSession s = req.getSession(false); if (s==null) { //redirect to login page with session expiry message } else { chain.doFilter(request, response); } }

NameValuePair,HttpParams,HttpConnection Params在登录app的服务器请求类上已弃用

第一次在这里问一个问题,并且是android编程的新手。 我正在按照在线youtube教程创建用户“Tonikami TV”的登录。 应用程序的一切都很好,除了它涉及到serverRequests类。 我得到了NameValuePair , HttpParams等不推荐使用,我知道它已经过时HttpParams支持自API 22.我已经搜索了一些固定的或替代的但是不能真正理解它们以及如何将它们应用到我的代码中。 任何帮助将不胜感激。 谢谢 :) @Override protected Void doInBackground(Void… params) { ArrayList dataToSend = new ArrayList(); dataToSend.add(new BasicNameValuePair(“firstname”, user.FirstName)); dataToSend.add(new BasicNameValuePair(“lastname”, user.LastName)); dataToSend.add(new BasicNameValuePair(“age”, user.Age + “”)); dataToSend.add(new BasicNameValuePair(“emailaddress”, user.EmailAddress)); dataToSend.add(new BasicNameValuePair(“password”, user.Password)); //possible alternative code found on stack overflow don’t know exactly what to do from here. ContentValues […]

Struts2从登录拦截器重定向

我们的应用程序要求用户登录以查看任何内容。 LoginInterceptor拦截对所有页面的访问,如果用户没有有效会话,则会调出登录表单。 我希望拦截器在显示登录表单之前记住原始请求URI,并在登录表单validation成功时重定向到它。 我尝试跟踪Struts 2 Redirect以在身份validation拦截器之后纠正操作 。 @Service @Results({ @Result(name = “redirect”, type = “redirect”, location = “${savedUrl}”) }) public class LoginInterceptor extends AbstractInterceptor { //… private String savedUrl; //… @Override public final String intercept(final ActionInvocation invocation) throws Exception { // … savedUrl = (String) session.getAttribute(“savedUrl”); // … if (processLogin(request, session)) { // validate login […]