Package org.springframework.security.core

Examples of org.springframework.security.core.Authentication


        model.put("applicationURL", url);
        mailEngine.sendMessage(message, templateName, model);
    }

    protected String getCurrentUsername() {
        final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        if(authentication != null && !isAnonymousLogin()) {
            return authentication.getName();
        }
        return null;
    }
View Full Code Here


        }
        return null;
    }

    protected boolean isAnonymousLogin() {
        final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        return authenticationTrustResolver.isAnonymous(authentication);
    }
View Full Code Here

        final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        return authenticationTrustResolver.isAnonymous(authentication);
    }

    protected boolean isRememberMeLogin() {
        final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        return authenticationTrustResolver.isRememberMe(authentication);
    }
View Full Code Here

       
        final HttpServletRequest request = webContext.getHttpServletRequest();
        final HttpServletResponse response = webContext.getHttpServletResponse();
        final ServletContext servletContext = webContext.getServletContext();
       
        final Authentication authentication = AuthUtils.getAuthenticationObject();

        if (authentication == null) {
            return false;
        }
       
View Full Code Here

        if (attributeValue == null || attributeValue.trim().equals("")) {
            return null;
        }
       
        final Authentication authentication = AuthUtils.getAuthenticationObject();
        final Object authenticationProperty =
                AuthUtils.getAuthenticationProperty(authentication, attributeValue);
       
        if (authenticationProperty == null) {
            return null;
View Full Code Here

                    "web environements.");
        }
        final IWebContext webContext = (IWebContext) context;
        final ServletContext servletContext = webContext.getServletContext();
       
        final Authentication authentication = AuthUtils.getAuthenticationObject();
        if (authentication == null) {
            return false;
        }

        final ApplicationContext applicationContext = AuthUtils.getContext(servletContext)
View Full Code Here

        @Override
        public boolean validate(X509Certificate certificate)
                throws CertificateValidationCallback.CertificateValidationException {
            boolean result;
            try {
                Authentication authResult =
                        authenticationManager.authenticate(new X509AuthenticationToken(certificate));
                if (logger.isDebugEnabled()) {
                    logger.debug("Authentication request for certificate with DN [" +
                            certificate.getSubjectX500Principal().getName() + "] successful");
                }
View Full Code Here

      User users = this.userDao.querySingleUser(username);
      if (users == null || !users.getUserPassword().equals(password)) {
        request.setAttribute("error", "用户或密码不正确!");
          return "/background/framework/login";
      }
      Authentication authentication = myAuthenticationManager
          .authenticate(new UsernamePasswordAuthenticationToken(username,password));
      SecurityContext securityContext = SecurityContextHolder.getContext();
      securityContext.setAuthentication(authentication);
      HttpSession session = request.getSession(true)
        session.setAttribute("SPRING_SECURITY_CONTEXT", securityContext)
View Full Code Here

    private Block elseBlock;

    private boolean test;

    private Collection<GrantedAuthority> getPrincipalAuthorities() {
        Authentication currentUser = null;
        currentUser = SecurityContextHolder.getContext().getAuthentication();

        if (null == currentUser) {
            return Collections.emptyList();
        }

        if ((null == currentUser.getAuthorities()) || (currentUser.getAuthorities().size() < 1)) {
            return Collections.emptyList();
        }

        return (Collection<GrantedAuthority>) currentUser.getAuthorities();
    }
View Full Code Here

    private Block elseBlock;

    private boolean test;

    private Collection<? extends GrantedAuthority> getPrincipalAuthorities() {
        Authentication currentUser = null;
        currentUser = SecurityContextHolder.getContext().getAuthentication();

        if (null == currentUser) {
            return Collections.emptyList();
        }

        if ((null == currentUser.getAuthorities()) || (currentUser.getAuthorities().size() < 1)) {
            return Collections.emptyList();
        }

        return (Collection<? extends GrantedAuthority>) currentUser.getAuthorities();
    }
View Full Code Here

TOP

Related Classes of org.springframework.security.core.Authentication

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.