@Test public void setUserInfoTest() { com.intuit.wasabi.authenticationobjects.UserInfo expected = com.intuit.wasabi.authenticationobjects.UserInfo.newInstance( com.intuit.wasabi.authenticationobjects.UserInfo.Username.valueOf("test")) .withEmail("test") .withFirstName("test") .withLastName("test") .build(); repository.setUserInfo(expected); verify(userInfoAccessor, times(1)).insertUserInfoBy(eq("test"), eq("test"), eq("test"), eq("test")); }
@Override public void setUserInfo(UserInfo userInfo) { try { userInfoAccessor.insertUserInfoBy(userInfo.getUsername().getUsername(), userInfo.getEmail(), userInfo.getFirstName(), userInfo.getLastName()); } catch (WriteTimeoutException | UnavailableException | NoHostAvailableException e) { throw new RepositoryException("Could not set info for user \"" + userInfo.getUsername() + "\"", e); } }
CassandraAuthorizationRepository implements AuthorizationRepository { @Override public void setUserInfo(UserInfo userInfo) { try { userInfoAccessor.insertUserInfoBy(userInfo.getUsername().getUsername(), userInfo.getEmail(), userInfo.getFirstName(), userInfo.getLastName()); } catch (WriteTimeoutException | UnavailableException | NoHostAvailableException e) { throw new RepositoryException("Could not set info for user \"" + userInfo.getUsername() + "\"", e); } } }
CassandraAuthorizationRepository implements AuthorizationRepository { @Override public void setUserInfo(UserInfo userInfo) { try { userInfoAccessor.insertUserInfoBy(userInfo.getUsername().getUsername(), userInfo.getEmail(), userInfo.getFirstName(), userInfo.getLastName()); } catch (WriteTimeoutException | UnavailableException | NoHostAvailableException e) { throw new RepositoryException("Could not set info for user \"" + userInfo.getUsername() + "\"", e); } } @Inject  CassandraAuthorizationRepository(ApplicationListAccessor applicationListAccessor,
                                            AppRoleAccessor appRoleAccessor,
                                            UserRoleAccessor userRoleAccessor,
                                            UserInfoAccessor userInfoAccessor,
                                            UserDirectory userDirectory,
                                            MappingManager mappingManager); }
CassandraAuthorizationRepository implements AuthorizationRepository { @Override public void setUserInfo(UserInfo userInfo) { try { userInfoAccessor.insertUserInfoBy(userInfo.getUsername().getUsername(), userInfo.getEmail(), userInfo.getFirstName(), userInfo.getLastName()); } catch (WriteTimeoutException | UnavailableException | NoHostAvailableException e) { throw new RepositoryException("Could not set info for user \"" + userInfo.getUsername() + "\"", e); } } @Inject  CassandraAuthorizationRepository(ApplicationListAccessor applicationListAccessor,
                                            AppRoleAccessor appRoleAccessor,
                                            UserRoleAccessor userRoleAccessor,
                                            UserInfoAccessor userInfoAccessor,
                                            UserDirectory userDirectory,
                                            MappingManager mappingManager); @Override UserPermissionsList getUserPermissionsList(UserInfo.Username userID); @Override UserRoleList getApplicationUsers(Application.Name applicationName); @Override UserPermissions getUserPermissions(@Nonnull UserInfo.Username username,
                                              @Nonnull Application.Name applicationName); @Override void deleteUserRole(UserInfo.Username userID, Application.Name applicationName); @Override void setUserRole(UserRole userRole); @Override UserRoleList getUserRoleList(UserInfo.Username userID); @Override UserInfo getUserInfo(UserInfo.Username userID); @Override void setUserInfo(UserInfo userInfo); @Override UserPermissions checkSuperAdminPermissions(UserInfo.Username userID, Application.Name applicationName); @Override void assignUserToSuperAdminRole(UserInfo candidateUser); @Override void removeUserFromSuperAdminRole(UserInfo candidateUser); @Override List<UserRole> getSuperAdminRoleList(); }
CassandraAuthorizationRepository implements AuthorizationRepository { @Override public void setUserInfo(UserInfo userInfo) { try { userInfoAccessor.insertUserInfoBy(userInfo.getUsername().getUsername(), userInfo.getEmail(), userInfo.getFirstName(), userInfo.getLastName()); } catch (WriteTimeoutException | UnavailableException | NoHostAvailableException e) { throw new RepositoryException("Could not set info for user \"" + userInfo.getUsername() + "\"", e); } } @Inject  CassandraAuthorizationRepository(ApplicationListAccessor applicationListAccessor,
                                            AppRoleAccessor appRoleAccessor,
                                            UserRoleAccessor userRoleAccessor,
                                            UserInfoAccessor userInfoAccessor,
                                            UserDirectory userDirectory,
                                            MappingManager mappingManager); @Override UserPermissionsList getUserPermissionsList(UserInfo.Username userID); @Override UserRoleList getApplicationUsers(Application.Name applicationName); @Override UserPermissions getUserPermissions(@Nonnull UserInfo.Username username,
                                              @Nonnull Application.Name applicationName); @Override void deleteUserRole(UserInfo.Username userID, Application.Name applicationName); @Override void setUserRole(UserRole userRole); @Override UserRoleList getUserRoleList(UserInfo.Username userID); @Override UserInfo getUserInfo(UserInfo.Username userID); @Override void setUserInfo(UserInfo userInfo); @Override UserPermissions checkSuperAdminPermissions(UserInfo.Username userID, Application.Name applicationName); @Override void assignUserToSuperAdminRole(UserInfo candidateUser); @Override void removeUserFromSuperAdminRole(UserInfo candidateUser); @Override List<UserRole> getSuperAdminRoleList(); static final String ALL_APPLICATIONS; }