Project

General

Profile

« Previous | Next » 

Revision 92a4f98e

Added by Andreas Kohlbecker about 7 years ago

Annotation based access control

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/view/AuthenticationPresenter.java
17 17

  
18 18
    @Override
19 19
    public boolean login(URI uri, String context, String userName, String password) {
20

  
20 21
        UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(userName, password);
21 22
        AuthenticationManager authenticationManager = (AuthenticationManager) CdmSpringContextHelper.getCurrent().getBean("authenticationManager");
22 23
        Authentication authentication = authenticationManager.authenticate(token);
24

  
23 25
        if(authentication != null && authentication.isAuthenticated()) {
24 26
            SecurityContextHolder.getContext().setAuthentication(authentication);
25 27
            CdmVaadinAuthentication cvAuthentication = (CdmVaadinAuthentication) VaadinSession.getCurrent().getAttribute(CdmVaadinAuthentication.KEY);
......
30 32
            CdmVaadinSessionUtilities.setCurrentAttribute(CdmVaadinAuthentication.KEY, cvAuthentication);
31 33
            return true;
32 34
        }
35

  
33 36
        return false;
34 37
    }
35 38

  

Also available in: Unified diff