Search in sources :

Example 1 with GatekeeperRoleService

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);
}
Also used : GatekeeperUserEntry(org.finra.gatekeeper.common.services.user.model.GatekeeperUserEntry) GatekeeperRoleService(org.finra.gatekeeper.services.auth.GatekeeperRoleService) Before(org.junit.Before)

Aggregations

GatekeeperUserEntry (org.finra.gatekeeper.common.services.user.model.GatekeeperUserEntry)1 GatekeeperRoleService (org.finra.gatekeeper.services.auth.GatekeeperRoleService)1 Before (org.junit.Before)1