use of org.finra.gatekeeper.services.auth.GatekeeperRoleService in project Gatekeeper by FINRAOS.
the class GatekeeperRoleServiceTest method initMocks.
@Before
public void initMocks() {
when(gatekeeperAuthProperties.getLdap()).thenReturn(new GatekeeperAuthProperties.GatekeeperLdapProperties().setUsersCnAttribute("cn").setUsersIdAttribute("sAMAccountName").setUsersEmailAttribute("mail").setUsersDnAttribute("distinguishedName").setGroupsBase("OU=GROUPS").setUsersBase("OU=Locations").setUsersNameAttribute("name"));
when(gatekeeperRdsAuthProperties.getDbaGroupsPattern()).thenReturn("COMPANY_([a-zA-Z]+)_DBA");
when(gatekeeperRdsAuthProperties.getOpsGroupsPattern()).thenReturn("COMPANY_([a-zA-Z]+)_OPS");
when(gatekeeperRdsAuthProperties.getDevGroupsPattern()).thenReturn("COMPANY_([a-zA-Z]+)_DEV_(DEV|QA|QC|PROD)");
when(userEntry.getEmail()).thenReturn("userEntry@gk.org");
when(userEntry.getName()).thenReturn("userName");
when(userEntry.getUserId()).thenReturn("test");
when(gatekeeperUserProfile.getName()).thenReturn("userName");
when(gatekeeperAuthProperties.getApproverGroup()).thenReturn("GK_RDS_APPROVER");
when(gatekeeperRoleService.getUserProfile()).thenReturn(gatekeeperUserProfile);
when(gatekeeperAuthorizationService.getUser()).thenReturn(new GatekeeperUserEntry("test", "dn", "userEntry@gk.org", "userName"));
users = new ArrayList<>();
users.add(userEntry);
gatekeeperRoleService = new GatekeeperRoleService(gatekeeperAuthorizationService, gatekeeperAuthProperties, gatekeeperRdsAuthProperties);
}
Aggregations