Package org.beangle.security.core.userdetail

Examples of org.beangle.security.core.userdetail.UserDetail


  private CasAuthentication authenticateNow(CasAuthentication auth) throws AuthenticationException {
    try {
      final Assertion assertion = ticketValidator.validate(auth.getCredentials().toString(),
          auth.getLoginUrl());
      String name = assertion.getPrincipal().getName();
      final UserDetail userDetail = userDetailService.loadDetail(new UsernamePasswordAuthentication(
          name, null));
      if (null == userDetail) {
        logger.error("cannot load {}'s detail from system", name);
        throw new UsernameNotFoundException(StrUtils.concat("user ", name, " not found in system"));
      }
      userDetailChecker.check(userDetail);
      return new CasAuthentication(key, userDetail, auth.getCredentials(), userDetail.getAuthorities(),
          userDetail, assertion);
    } catch (final TicketValidationException e) {
      throw new BadCredentialsException("Bad credentials :" + auth.getCredentials().toString(), e);
    }
  }
View Full Code Here


  public Authentication authenticate(Authentication authentication) throws AuthenticationException {
    // Determine username
    String username = (authentication.getPrincipal() == null) ? "NONE_PROVIDED" : authentication
        .getName();

    UserDetail user = retrieveUser(username, authentication);

    if (null == user) { throw new UsernameNotFoundException(); }
    preAuthenticationChecker.check(user);

    additionalAuthenticationChecks(user, authentication);

    postAuthenticationChecker.check(user);

    Object principalToReturn = user;

    if (forcePrincipalAsString) {
      principalToReturn = user.getUsername();
    }

    return createSuccessAuthentication(principalToReturn, authentication, user);
  }
View Full Code Here

      throws AuthenticationException {
    // Determine username
    String username = (authentication.getPrincipal() == null) ? "NONE_PROVIDED"
        : authentication.getName();

    UserDetail user = retrieveUser(username, (UsernamePasswordAuthentication) authentication);

    if (null == user) { throw new UsernameNotFoundException(textResource.getText(
        "AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials")); }
    preAuthenticationChecker.check(user);

    additionalAuthenticationChecks(user, (UsernamePasswordAuthentication) authentication);

    postAuthenticationChecker.check(user);

    Object principalToReturn = user;

    if (forcePrincipalAsString) {
      principalToReturn = user.getUsername();
    }

    return createSuccessAuthentication(principalToReturn, authentication, user);
  }
View Full Code Here

  private CasAuthentication authenticateNow(CasAuthentication auth) throws AuthenticationException {
    try {
      final Assertion assertion = ticketValidator.validate(auth.getCredentials().toString(),
          auth.getLoginUrl());
      String name = assertion.getPrincipal();
      final UserDetail userDetail = userDetailService.loadDetail(new UsernamePasswordAuthentication(
          name, null));
      if (null == userDetail) {
        logger.error("cannot load {}'s detail from system", name);
        throw new UsernameNotFoundException(StrUtils.concat("user ", name, " not found in system"));
      }
      userDetailChecker.check(userDetail);
      return new CasAuthentication(key, userDetail, auth.getCredentials(), userDetail.getAuthorities(),
          userDetail, assertion);
    } catch (final TicketValidationException e) {
      throw new BadCredentialsException("Bad credentials :" + auth.getCredentials().toString(), e);
    }
  }
View Full Code Here

  private CasAuthentication authenticateNow(CasAuthentication auth)
      throws AuthenticationException {
    try {
      final Assertion assertion = ticketValidator.validate(auth.getCredentials().toString(),
          auth.getLoginUrl());
      final UserDetail userDetails = userDetailService.loadDetail(auth);
      userDetailChecker.check(userDetails);
      return new CasAuthentication(key, userDetails, auth.getCredentials(),
          userDetails.getAuthorities(), userDetails, assertion);
    } catch (final TicketValidationException e) {
      logger.error("Bad credentials :" + auth.getCredentials().toString(), e);
      throw new BadCredentialsException("", e);
    }
  }
View Full Code Here

TOP

Related Classes of org.beangle.security.core.userdetail.UserDetail

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.