Package org.dedeler.template.model

Examples of org.dedeler.template.model.User


          RoleService roleService = applicationContext.getBean(RoleService.class);
          UserService userService = applicationContext.getBean(UserService.class);
         
          Role role = new Role("ROLE_USER");

          User user = new User();
          user.setUsername("admin");
          user.setPassword("7lLEodyoRSvB9W6Rhjc+xfabU0ITmcdbjaW4MfARG5TOb/N7TeMxDB85j/HSm8t1h6pTrATIXySR+yQ5jMo39Q==");// admin
          user.setFirstName("Destan");
          user.setAuthorities(Arrays.asList(role));

          roleService.save(role);
          userService.save(user);

          initialized = true;
View Full Code Here


  private UserService userService;
 
  @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  @ResponseBody
  public Result show(@PathVariable("id") String id) {
    User user = userService.findById(User.class, Long.parseLong(id));
   
    return new Builder(true).resultObject(user).build();
  }
View Full Code Here

  @RequestMapping(value = "/createUser", method = RequestMethod.GET)
  @ResponseBody
  public long createUser() {
    Role role = new Role("ROLE_USER");
       
    User user = new User();
    user.setUsername("admin");
    user.setPassword("7lLEodyoRSvB9W6Rhjc+xfabU0ITmcdbjaW4MfARG5TOb/N7TeMxDB85j/HSm8t1h6pTrATIXySR+yQ5jMo39Q==");// admin
    user.setFirstName("Destan");
    user.setAuthorities(Arrays.asList(role));
   
    roleService.save(role);
    return userService.save(user);
  }
View Full Code Here

  public Authentication authenticate(Authentication authentication) throws AuthenticationException {
    String username = authentication.getName();
    Object password = authentication.getCredentials();
    try {
      String hashedPassword = ESAPI.encryptor().hash((String) password, username);
      User user = userService.findByUsername(username);

      if (user == null) {
        throw new BadCredentialsException("Username not found."); // TODO message
      }

      if (!hashedPassword.equals(user.getPassword())) {
        throw new BadCredentialsException("Wrong password."); // TODO message
      }

      Collection<? extends GrantedAuthority> authorities = user.getAuthorities();
      return new UsernamePasswordAuthenticationToken(username, password, authorities);

    }
    catch (EncryptionException e) {
      e.printStackTrace();
View Full Code Here

TOP

Related Classes of org.dedeler.template.model.User

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.