@Test public void testUserCrn() { String crn = "crn:cdp:iam:us-west-1:9d74eee4-1cad-45d7-b645-7ccf9edbb73d:user:qaas/b8a64902-7765-4ddd-a4f3-df81ae585e10"; UserManagementProto.User user = UserManagementProto.User.newBuilder() .setUserId("userId") .setEmail("e@mail.com") .setCrn(crn) .build(); when(grpcUmsClient.getUserDetails(anyString(), anyString(), any())).thenReturn(user); CloudbreakUser cloudbreakUser = underTest.getCloudbreakUser(crn, null); assertEquals("userId", cloudbreakUser.getUserId()); assertEquals("e@mail.com", 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);  }