コード例 #1
0
 private void validateConnection(Connection connection, RichUserDetails richUserDetails)
     throws ServiceException {
   try {
     validateProviderNsa(connection.getProviderNsa());
     validateConnectionId(connection.getConnectionId());
     validatePort(connection.getSourceStpId(), "sourceSTP", richUserDetails);
     validatePort(connection.getDestinationStpId(), "destSTP", richUserDetails);
   } catch (ServiceException e) {
     connection.setCurrentState(TERMINATED);
     connectionRepo.save(connection);
     throw e;
   }
 }
コード例 #2
0
  @Override
  public GenericAcknowledgmentType provision(ProvisionRequestType parameters)
      throws ServiceException {
    validateOAuthScope(NsiScope.PROVISION);
    validateProviderNsa(parameters.getProvision().getProviderNSA());

    Connection connection = getConnectionOrFail(parameters.getProvision().getConnectionId());

    log.info("Received provision request for connection: {}", connection);

    NsiRequestDetails requestDetails =
        new NsiRequestDetails(parameters.getReplyTo(), parameters.getCorrelationId());
    connectionService.provision(connection.getId(), requestDetails);

    return createGenericAcknowledgment(requestDetails.getCorrelationId());
  }
コード例 #3
0
  @Override
  public GenericAcknowledgmentType terminate(TerminateRequestType parameters)
      throws ServiceException {
    log.info(
        "Received a NSI terminate request for connectionId '{}'",
        parameters.getTerminate().getConnectionId());

    validateOAuthScope(NsiScope.TERMINATE);
    validateProviderNsa(parameters.getTerminate().getProviderNSA());

    Connection connection = getConnectionOrFail(parameters.getTerminate().getConnectionId());

    NsiRequestDetails requestDetails =
        new NsiRequestDetails(parameters.getReplyTo(), parameters.getCorrelationId());

    connectionService.asyncTerminate(
        connection.getId(),
        parameters.getTerminate().getRequesterNSA(),
        requestDetails,
        Security.getUserDetails());

    return createGenericAcknowledgment(requestDetails.getCorrelationId());
  }