@Test public void userLookup() { com.intuit.wasabi.authenticationobjects.UserInfo userInfo = com.intuit.wasabi.authenticationobjects.UserInfo.newInstance( com.intuit.wasabi.authenticationobjects.UserInfo.Username.valueOf("test")) .withEmail("test") .withFirstName("test") .withLastName("test") .build(); com.intuit.wasabi.authenticationobjects.UserInfo.Username userName = com.intuit.wasabi.authenticationobjects.UserInfo.Username.valueOf("test"); when(userDirectory.lookupUser(eq(userName))) .thenReturn(userInfo); assertThat(userInfo, is(repository.lookupUser(userName))); }
UserInfo lookupUser(UserInfo.Username userID) { UserInfo userInfo; try { LOGGER.debug("Workforce-getApplicationUsers: looking up user {}", userID.toString()); userInfo = userDirectory.lookupUser(userID); } catch (AuthenticationException e) { LOGGER.warn(String.format("Workforce-getApplicationUsers: problem looking up user %s", userID.toString()), e); userInfo = UserInfo.newInstance(userID) .withEmail("") .withFirstName("") .withLastName("") .build(); } return userInfo; }
CassandraAuthorizationRepository implements AuthorizationRepository { UserInfo lookupUser(UserInfo.Username userID) { UserInfo userInfo; try { LOGGER.debug("Workforce-getApplicationUsers: looking up user {}", userID.toString()); userInfo = userDirectory.lookupUser(userID); } catch (AuthenticationException e) { LOGGER.warn(String.format("Workforce-getApplicationUsers: problem looking up user %s", userID.toString()), e); userInfo = UserInfo.newInstance(userID) .withEmail("") .withFirstName("") .withLastName("") .build(); } return userInfo; } }
CassandraAuthorizationRepository implements AuthorizationRepository { UserInfo lookupUser(UserInfo.Username userID) { UserInfo userInfo; try { LOGGER.debug("Workforce-getApplicationUsers: looking up user {}", userID.toString()); userInfo = userDirectory.lookupUser(userID); } catch (AuthenticationException e) { LOGGER.warn(String.format("Workforce-getApplicationUsers: problem looking up user %s", userID.toString()), e); userInfo = UserInfo.newInstance(userID) .withEmail("") .withFirstName("") .withLastName("") .build(); } return userInfo; } @Inject  CassandraAuthorizationRepository(ApplicationListAccessor applicationListAccessor,
                                            AppRoleAccessor appRoleAccessor,
                                            UserRoleAccessor userRoleAccessor,
                                            UserInfoAccessor userInfoAccessor,
                                            UserDirectory userDirectory,
                                            MappingManager mappingManager); }
CassandraAuthorizationRepository implements AuthorizationRepository { UserInfo lookupUser(UserInfo.Username userID) { UserInfo userInfo; try { LOGGER.debug("Workforce-getApplicationUsers: looking up user {}", userID.toString()); userInfo = userDirectory.lookupUser(userID); } catch (AuthenticationException e) { LOGGER.warn(String.format("Workforce-getApplicationUsers: problem looking up user %s", userID.toString()), e); userInfo = UserInfo.newInstance(userID) .withEmail("") .withFirstName("") .withLastName("") .build(); } return userInfo; } @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 { UserInfo lookupUser(UserInfo.Username userID) { UserInfo userInfo; try { LOGGER.debug("Workforce-getApplicationUsers: looking up user {}", userID.toString()); userInfo = userDirectory.lookupUser(userID); } catch (AuthenticationException e) { LOGGER.warn(String.format("Workforce-getApplicationUsers: problem looking up user %s", userID.toString()), e); userInfo = UserInfo.newInstance(userID) .withEmail("") .withFirstName("") .withLastName("") .build(); } return userInfo; } @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; }