acegi セキュリティ モジュールを使用するサーブレット アプリケーションでフォーム ベースのログインを回避する方法はありますか? どうにかログインとパスワードをURLに渡したいです。私はこのようなものを呼び出そうとしました:
GrantedAuthority[] grantedAuthorities = new GrantedAuthority[] {new GrantedAuthorityImpl("ROLE_ADMIN")};
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken("admin", "passwordofadmin", grantedAuthorities);
WebAuthenticationDetails authdetails = (WebAuthenticationDetails) authentication.getDetails();
HttpSession session = event.getSession();
ProviderManager pm = (ProviderManager)WebApplicationContextUtils.getWebApplicationContext(session.getServletContext()).getBean("authenticationManager");
pm.doAuthentication(authentication);
SecurityContextHolder.getContext().setAuthentication(authentication);
イベントのハンドラーで、HttpSessionCreatedEvent
イベントを受け取りAuthenticationSuccessEvent
ましたが、Failure
イベントも受け取り、認証フォームが表示されました。