javax.management.relation.RoleNotFoundException Java Examples
The following examples show how to use
javax.management.relation.RoleNotFoundException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RedirectController.java From Qualitis with Apache License 2.0 | 6 votes |
private void loginByUser(String username, HttpServletRequest request) { // 查询数据库,看用户是否存在 User userInDb = userDao.findByUsername(username); if (userInDb != null) { // 放入session LOGGER.info("User: {} succeed to login", username); loginService.addToSession(username, request); } else { // 自动创建用户 LOGGER.warn("user: {}, do not exist, trying to create user", username); try { userService.autoAddUser(username); loginService.addToSession(username, request); } catch (RoleNotFoundException e) { LOGGER.error("Failed to auto add user, cause by: Failed to get role [PROJECTOR]", e); } } }
Example #2
Source File: UserServiceImpl.java From Qualitis with Apache License 2.0 | 6 votes |
@Override @Transactional(rollbackFor = {Exception.class}) public void autoAddUser(String username) throws RoleNotFoundException { User newUser = new User(); String password = username; String passwordEncoded = Sha256Encoder.encode(password); newUser.setUsername(username); newUser.setPassword(passwordEncoded); User savedUser = userDao.saveUser(newUser); Role role = roleDao.findByRoleName("PROJECTOR"); if (role == null) { throw new RoleNotFoundException(); } UserRole userRole = new UserRole(); userRole.setId(UuidGenerator.generate()); userRole.setRole(role); userRole.setUser(savedUser); userRoleDao.saveUserRole(userRole); LOGGER.info("Succeed to save user_role. uuid: {}, user_id: {}, role_id: {}", userRole.getId(), savedUser.getId(), role.getId()); }
Example #3
Source File: UserService.java From Qualitis with Apache License 2.0 | 2 votes |
/** * Auto register user * @param username * @throws RoleNotFoundException */ void autoAddUser(String username) throws RoleNotFoundException;