Package org.beangle.security.core

Examples of org.beangle.security.core.AuthenticationException


  private static ThreadLocal<String> resource = new ThreadLocal<String>();

  private static UserToken getPrincipal() {
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    if (null == auth) throw new AuthenticationException();
    UserToken user = (UserToken) auth.getPrincipal();
    if (null == user.getId()) throw new AuthenticationException();
    return user;
  }
View Full Code Here


   * @return an authenticated <tt>Authentication</tt> object.
   */
  private Authentication authenticateIfRequired() {
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    if(null==authentication){
      throw new AuthenticationException();
    }
    if (authentication.isAuthenticated() && !alwaysReauthenticate) {
      logger.debug("Previously Authenticated: {}", authentication);
      return authentication;
    }
View Full Code Here

        logger.debug("{} access {} is denied", auth.getName(), ae.getResource());
        accessDeniedHandler.handle(request, response, (AccessDeniedException) exception);
      } else {
        logger.debug("anonymous access {} is denied", ae.getResource());
        sendStartAuthentication(request, response, chain,
            new AuthenticationException(ae.getMessage()));
      }
    }
  }
View Full Code Here

  }

  public Authentication doAuthentication(Authentication auth) throws AuthenticationException {
    Iterator<AuthenticationProvider> iter = getProviders().iterator();
    Class<? extends Authentication> toTest = auth.getClass();
    AuthenticationException lastException = null;

    while (iter.hasNext()) {
      AuthenticationProvider provider = iter.next();
      if (!provider.supports(toTest)) {
        continue;
View Full Code Here

    restrictionService.apply(query, getRestrictions());
  }

  protected UserToken getAuthentication() {
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    if (null == auth) throw new AuthenticationException();
    UserToken user = (UserToken) auth.getPrincipal();
    if (null == user.getId()) throw new AuthenticationException();
    return user;
  }
View Full Code Here

  private static ThreadLocal<String> resource = new ThreadLocal<String>();

  public static UserToken getPrincipal() {
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    if (null == auth) throw new AuthenticationException();
    UserToken user = (UserToken) auth.getPrincipal();
    if (null == user.getId()) throw new AuthenticationException();
    return user;
  }
View Full Code Here

  }

  public Authentication doAuthentication(Authentication auth) throws AuthenticationException {
    Iterator<AuthenticationProvider> iter = getProviders().iterator();
    Class<? extends Authentication> toTest = auth.getClass();
    AuthenticationException lastException = null;

    while (iter.hasNext()) {
      AuthenticationProvider provider = iter.next();
      if (!provider.supports(toTest)) {
        continue;
View Full Code Here

  }

  public Authentication doAuthentication(Authentication auth) throws AuthenticationException {
    Iterator<AuthenticationProvider> iter = getProviders().iterator();
    Class<? extends Authentication> toTest = auth.getClass();
    AuthenticationException lastException = null;

    while (iter.hasNext()) {
      AuthenticationProvider provider = iter.next();
      if (!provider.supports(toTest)) {
        continue;
View Full Code Here

        logger.debug("{} access {} is denied", auth.getName(), ae.getResource());
        accessDeniedHandler.handle(request, response, (AuthorizationException) exception);
      } else {
        logger.debug("anonymous access {} is denied", ae.getResource());
        sendStartAuthentication(request, response, chain,
            new AuthenticationException(ae.getMessage()));
      }
    }
  }
View Full Code Here

              return new String((byte[]) context.getObjectAttribute("userPassword"));
            }
          });
    } catch (EntryNotFoundException e) {
      logger.info("cannot found {} in ldap", username);
      throw new AuthenticationException("ldap user " + username + " not found");
    }
    return new User(username, ldapPassword, false, false, false, false, null);
  }
View Full Code Here

TOP

Related Classes of org.beangle.security.core.AuthenticationException

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.