Ejemplo n.º 1
0
 @Override
 protected String getResource() {
   if (null == href) {
     this.href = Strings.concat("/security/user!dashboard?user.id=", user.getId().toString());
   }
   return this.href;
 }
 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(name);
     if (null == userDetail) {
       logger.error("cannot load {}'s detail from system", name);
       throw new UsernameNotFoundException(Strings.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);
   }
 }