@Test void testGetPrerequisitesForCloudPlatform() { CredentialPrerequisitesResponse credentialPrerequisitesResponse = mock(CredentialPrerequisitesResponse.class); when(credentialService.getPrerequisites(PLATFORM, DEPLOYMENT_ADDRESS, USER_CRN, CredentialType.ENVIRONMENT)) .thenReturn(credentialPrerequisitesResponse); CredentialPrerequisitesResponse response = ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.getPrerequisitesForCloudPlatform(PLATFORM, DEPLOYMENT_ADDRESS)); assertThat(response).isEqualTo(credentialPrerequisitesResponse); }
@Override @CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CREDENTIAL) public CredentialPrerequisitesResponse getPrerequisitesForCloudPlatform(String platform, String deploymentAddress) { String userCrn = ThreadBasedUserCrnProvider.getUserCrn(); return credentialService.getPrerequisites(platform, deploymentAddress, userCrn, ENVIRONMENT); }
CredentialV1Controller extends NotificationController implements CredentialEndpoint { @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CREDENTIAL) public CredentialPrerequisitesResponse getPrerequisitesForCloudPlatform(String platform, String deploymentAddress) { String userCrn = ThreadBasedUserCrnProvider.getUserCrn(); return credentialService.getPrerequisites(platform, deploymentAddress, userCrn, ENVIRONMENT); } }
CredentialV1Controller extends NotificationController implements CredentialEndpoint { @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CREDENTIAL) public CredentialPrerequisitesResponse getPrerequisitesForCloudPlatform(String platform, String deploymentAddress) { String userCrn = ThreadBasedUserCrnProvider.getUserCrn(); return credentialService.getPrerequisites(platform, deploymentAddress, userCrn, ENVIRONMENT); } CredentialV1Controller(
            CredentialService credentialService,
            CredentialToCredentialV1ResponseConverter credentialConverter,
            CredentialDeleteService credentialDeleteService); }
CredentialV1Controller extends NotificationController implements CredentialEndpoint { @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CREDENTIAL) public CredentialPrerequisitesResponse getPrerequisitesForCloudPlatform(String platform, String deploymentAddress) { String userCrn = ThreadBasedUserCrnProvider.getUserCrn(); return credentialService.getPrerequisites(platform, deploymentAddress, userCrn, ENVIRONMENT); } CredentialV1Controller(
            CredentialService credentialService,
            CredentialToCredentialV1ResponseConverter credentialConverter,
            CredentialDeleteService credentialDeleteService); @Override @DisableCheckPermissions CredentialResponses list(); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_CREDENTIAL) CredentialResponse getByName(@ResourceName String credentialName); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_CREDENTIAL_ON_ENVIRONMENT) CredentialResponse getByEnvironmentCrn(@TenantAwareParam @ResourceCrn String environmentCrn); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_CREDENTIAL_ON_ENVIRONMENT) CredentialResponse getByEnvironmentName(@ResourceName String environmentName); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_CREDENTIAL) CredentialResponse getByResourceCrn(@TenantAwareParam @ResourceCrn String credentialCrn); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CREDENTIAL) CredentialResponse post(@Valid CredentialRequest request); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.DELETE_CREDENTIAL) CredentialResponse deleteByName(@ResourceName String name); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DELETE_CREDENTIAL) CredentialResponse deleteByResourceCrn(@TenantAwareParam @ResourceCrn String crn); @Override @CheckPermissionByResourceNameList(action = AuthorizationResourceAction.DELETE_CREDENTIAL) CredentialResponses deleteMultiple(@ResourceNameList Set<String> names); @Override @CheckPermissionByResourceObject CredentialResponse put(@ResourceObject @Valid CredentialRequest credentialRequest); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CREDENTIAL) InteractiveCredentialResponse interactiveLogin(@Valid CredentialRequest credentialRequest); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CREDENTIAL) CredentialPrerequisitesResponse getPrerequisitesForCloudPlatform(String platform, String deploymentAddress); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CREDENTIAL) Response initCodeGrantFlow(CredentialRequest credentialRequest); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.EDIT_CREDENTIAL) Response initCodeGrantFlowOnExisting(@ResourceName String name); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CREDENTIAL) CredentialResponse authorizeCodeGrantFlow(String platform, String code, String state); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_CREDENTIAL) CredentialResponse verifyByName(@ResourceName String name); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_CREDENTIAL) CredentialResponse verifyByCrn(@TenantAwareParam @ResourceCrn String crn); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CREDENTIAL) Object getCreateCredentialForCli(CredentialRequest credentialRequest); }
CredentialV1Controller extends NotificationController implements CredentialEndpoint { @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CREDENTIAL) public CredentialPrerequisitesResponse getPrerequisitesForCloudPlatform(String platform, String deploymentAddress) { String userCrn = ThreadBasedUserCrnProvider.getUserCrn(); return credentialService.getPrerequisites(platform, deploymentAddress, userCrn, ENVIRONMENT); } CredentialV1Controller(
            CredentialService credentialService,
            CredentialToCredentialV1ResponseConverter credentialConverter,
            CredentialDeleteService credentialDeleteService); @Override @DisableCheckPermissions CredentialResponses list(); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_CREDENTIAL) CredentialResponse getByName(@ResourceName String credentialName); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_CREDENTIAL_ON_ENVIRONMENT) CredentialResponse getByEnvironmentCrn(@TenantAwareParam @ResourceCrn String environmentCrn); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_CREDENTIAL_ON_ENVIRONMENT) CredentialResponse getByEnvironmentName(@ResourceName String environmentName); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_CREDENTIAL) CredentialResponse getByResourceCrn(@TenantAwareParam @ResourceCrn String credentialCrn); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CREDENTIAL) CredentialResponse post(@Valid CredentialRequest request); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.DELETE_CREDENTIAL) CredentialResponse deleteByName(@ResourceName String name); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DELETE_CREDENTIAL) CredentialResponse deleteByResourceCrn(@TenantAwareParam @ResourceCrn String crn); @Override @CheckPermissionByResourceNameList(action = AuthorizationResourceAction.DELETE_CREDENTIAL) CredentialResponses deleteMultiple(@ResourceNameList Set<String> names); @Override @CheckPermissionByResourceObject CredentialResponse put(@ResourceObject @Valid CredentialRequest credentialRequest); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CREDENTIAL) InteractiveCredentialResponse interactiveLogin(@Valid CredentialRequest credentialRequest); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CREDENTIAL) CredentialPrerequisitesResponse getPrerequisitesForCloudPlatform(String platform, String deploymentAddress); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CREDENTIAL) Response initCodeGrantFlow(CredentialRequest credentialRequest); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.EDIT_CREDENTIAL) Response initCodeGrantFlowOnExisting(@ResourceName String name); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CREDENTIAL) CredentialResponse authorizeCodeGrantFlow(String platform, String code, String state); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_CREDENTIAL) CredentialResponse verifyByName(@ResourceName String name); @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_CREDENTIAL) CredentialResponse verifyByCrn(@TenantAwareParam @ResourceCrn String crn); @Override @CheckPermissionByAccount(action = AuthorizationResourceAction.CREATE_CREDENTIAL) Object getCreateCredentialForCli(CredentialRequest credentialRequest);  }