@Test public void testInvalidTypeCrn() { thrown.expect(UmsAuthenticationException.class); String crn = "crn:cdp:iam:us-west-1:9d74eee4-1cad-45d7-b645-7ccf9edbb73d:cluster:qaas/b8a64902-7765-4ddd-a4f3-df81ae585e10"; try { underTest.getCloudbreakUser(crn, "principal"); } catch (UmsAuthenticationException e) { assertEquals("Authentication is supported only with User and MachineUser CRN: " + crn, e.getMessage()); throw e; } }
@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);  }