@Test public void testMachineUserCrn() { String crn = "crn:cdp:iam:us-west-1:9d74eee4-1cad-45d7-b645-7ccf9edbb73d:machineUser:qaas/b8a64902-7765-4ddd-a4f3-df81ae585e10"; UserManagementProto.MachineUser machineUser = UserManagementProto.MachineUser.newBuilder() .setMachineUserId("machineUserId") .setCrn(crn) .build(); when(grpcUmsClient.getMachineUserDetails(anyString(), anyString(), anyString(), any())).thenReturn(machineUser); CloudbreakUser cloudbreakUser = underTest.getCloudbreakUser(crn, "principal"); assertEquals("machineUserId", cloudbreakUser.getUserId()); assertEquals("principal", cloudbreakUser.getUsername()); assertEquals(crn, cloudbreakUser.getUserCrn()); }
@Override public CloudbreakUser getCloudbreakUser(Authentication auth) { if (auth.getPrincipal() instanceof CrnUser) { CrnUser crnuser = (CrnUser) auth.getPrincipal(); return getCloudbreakUser(crnuser.getUserCrn(), null); } return null; }
UmsAuthenticationService implements AuthenticationService { @Override public CloudbreakUser getCloudbreakUser(Authentication auth) { if (auth.getPrincipal() instanceof CrnUser) { CrnUser crnuser = (CrnUser) auth.getPrincipal(); return getCloudbreakUser(crnuser.getUserCrn(), null); } return null; } }
UmsAuthenticationService implements AuthenticationService { @Override public CloudbreakUser getCloudbreakUser(Authentication auth) { if (auth.getPrincipal() instanceof CrnUser) { CrnUser crnuser = (CrnUser) auth.getPrincipal(); return getCloudbreakUser(crnuser.getUserCrn(), null); } return null; } UmsAuthenticationService(GrpcUmsClient umsClient); }
UmsAuthenticationService implements AuthenticationService { @Override public CloudbreakUser getCloudbreakUser(Authentication auth) { if (auth.getPrincipal() instanceof CrnUser) { CrnUser crnuser = (CrnUser) auth.getPrincipal(); return getCloudbreakUser(crnuser.getUserCrn(), null); } return null; } UmsAuthenticationService(GrpcUmsClient umsClient); @Override CloudbreakUser getCloudbreakUser(Authentication auth); CloudbreakUser getCloudbreakUser(String userCrn, String principal); }
UmsAuthenticationService implements AuthenticationService { @Override public CloudbreakUser getCloudbreakUser(Authentication auth) { if (auth.getPrincipal() instanceof CrnUser) { CrnUser crnuser = (CrnUser) auth.getPrincipal(); return getCloudbreakUser(crnuser.getUserCrn(), null); } return null; } UmsAuthenticationService(GrpcUmsClient umsClient); @Override CloudbreakUser getCloudbreakUser(Authentication auth); CloudbreakUser getCloudbreakUser(String userCrn, String principal);  }