- public void logInAsAnonymous() {
- Subject subject = new Subject();
- final LoginContext loginContext;
- try {
- loginContext = new ArgeoLoginContext(
- KernelHeader.LOGIN_CONTEXT_ANONYMOUS, subject);
- loginContext.login();
- } catch (LoginException e1) {
- throw new ArgeoException("Cannot authenticate anonymous", e1);
- }
- }
-
- public void logInWithPassword(String username, char[] password) {
- NodeAuthenticationToken token = new NodeAuthenticationToken(username,
- password);
- Authentication authentication = authenticationManager
- .authenticate(token);
- SecurityContextHolder.getContext().setAuthentication(authentication);
- HttpSession httpSession = RWT.getRequest().getSession();
- httpSession.setAttribute(SPRING_SECURITY_CONTEXT_KEY,
- SecurityContextHolder.getContext());
- if (log.isDebugEnabled())
- log.debug("Authenticated as " + authentication);