integration-impl/src/main/java/se/idsec/signservice/integration/process/impl/DefaultSignerAssertionInfoProcessor.java
protected long processAuthenticationInstant(final ContextInfo contextInfo, final SignRequestWrapper signRequest,
      final SignResponseWrapper signResponse)
      throws SignServiceIntegrationException {

    if (contextInfo.getAuthenticationInstant() == null) {
      final String msg =
          String.format("No SignerAssertionInfo/ContextInfo/AuthenticationInstant available in SignResponse [request-id='%s']",
            signRequest.getRequestID());
      log.error("{}: {}", CorrelationID.id(), msg);
      throw new SignServiceProtocolException(msg);
    }
    final long authnInstant = contextInfo.getAuthenticationInstant().toGregorianCalendar().getTimeInMillis();
    final long requestTime = signRequest.getSignRequestExtension().getRequestTime().toGregorianCalendar().getTimeInMillis();
    final long responseTime = signResponse.getSignResponseExtension().getResponseTime().toGregorianCalendar().getTimeInMillis();

    if ((authnInstant + this.processingConfig.getAllowedClockSkew()) < requestTime) {
      final String msg = String.format("Invalid authentication instant (%d). It is before the SignRequest was sent (%d) [request-id='%s']",
        authnInstant, requestTime, signRequest.getRequestID());
      log.error("{}: {}", CorrelationID.id(), msg);
      throw new SignResponseProcessingException(new ErrorCode.Code("invalid-response"), msg);
    }
    if ((authnInstant - this.processingConfig.getAllowedClockSkew()) > responseTime) {
      final String msg = String.format("Invalid authentication instant (%d). It is after the SignResponse time (%d) [request-id='%s']",
        authnInstant, responseTime, signRequest.getRequestID());
      log.error("{}: {}", CorrelationID.id(), msg);
      throw new SignResponseProcessingException(new ErrorCode.Code("invalid-response"), msg);
    }
    return authnInstant;
  }
/**
   * Validates that the received authentication instant is OK.
   * 
   * @param contextInfo
   *          the context info holding the authn instant
   * @param signRequest
   *          the sign request
   * @param signResponse
   *          the sign response
   * @throws SignServiceIntegrationException
   *           for validation errors
   */
Validates that the received authentication instant is OK.

@param contextInfo
the context info holding the authn instant
@param signRequest
the sign request
@param signResponse
the sign response
@throws SignServiceIntegrationException
for validation errors
Validates that the received authentication instant is OK . @param contextInfo the context info holding the authn instant @param signRequest the sign request @param signResponse the sign response @throws SignServiceIntegrationException for validation errors
protected long processAuthenticationInstant(final ContextInfo contextInfo, final SignRequestWrapper signRequest,
      final SignResponseWrapper signResponse)
      throws SignServiceIntegrationException {
    if (contextInfo.getAuthenticationInstant() == null) {
      final String msg =
          String.format("No SignerAssertionInfo/ContextInfo/AuthenticationInstant available in SignResponse [request-id='%s']",
            signRequest.getRequestID());
      log.error("{}: {}", CorrelationID.id(), msg);
      throw new SignServiceProtocolException(msg);
    }
    final long authnInstant = contextInfo.getAuthenticationInstant().toGregorianCalendar().getTimeInMillis();
    final long requestTime = signRequest.getSignRequestExtension().getRequestTime().toGregorianCalendar().getTimeInMillis();
    final long responseTime = signResponse.getSignResponseExtension().getResponseTime().toGregorianCalendar().getTimeInMillis();
    if ((authnInstant + this.processingConfig.getAllowedClockSkew()) < requestTime) {
      final String msg = String.format("Invalid authentication instant (%d). It is before the SignRequest was sent (%d) [request-id='%s']",
        authnInstant, requestTime, signRequest.getRequestID());
      log.error("{}: {}", CorrelationID.id(), msg);
      throw new SignResponseProcessingException(new ErrorCode.Code("invalid-response"), msg);
    }
    if ((authnInstant - this.processingConfig.getAllowedClockSkew()) > responseTime) {
      final String msg = String.format("Invalid authentication instant (%d). It is after the SignResponse time (%d) [request-id='%s']",
        authnInstant, responseTime, signRequest.getRequestID());
      log.error("{}: {}", CorrelationID.id(), msg);
      throw new SignResponseProcessingException(new ErrorCode.Code("invalid-response"), msg);
    }
    return authnInstant;
  }
protected long processAuthenticationInstant ( final ContextInfo contextInfo , final SignRequestWrapper signRequest , final SignResponseWrapper signResponse ) throws SignServiceIntegrationException { if ( contextInfo . getAuthenticationInstant ( ) == null ) { final String msg = String . format ( "No SignerAssertionInfo/ContextInfo/AuthenticationInstant available in SignResponse [request-id='%s']" , signRequest . getRequestID ( ) ) ; log . error ( "{}: {}" , CorrelationID . id ( ) , msg ) ; throw new SignServiceProtocolException ( msg ) ; } final long authnInstant = contextInfo . getAuthenticationInstant ( ) . toGregorianCalendar ( ) . getTimeInMillis ( ) ; final long requestTime = signRequest . getSignRequestExtension ( ) . getRequestTime ( ) . toGregorianCalendar ( ) . getTimeInMillis ( ) ; final long responseTime = signResponse . getSignResponseExtension ( ) . getResponseTime ( ) . toGregorianCalendar ( ) . getTimeInMillis ( ) ; if ( ( authnInstant + this . processingConfig . getAllowedClockSkew ( ) ) < requestTime ) { final String msg = String . format ( "Invalid authentication instant (%d). It is before the SignRequest was sent (%d) [request-id='%s']" , authnInstant , requestTime , signRequest . getRequestID ( ) ) ; log . error ( "{}: {}" , CorrelationID . id ( ) , msg ) ; throw new SignResponseProcessingException ( new ErrorCode . Code ( "invalid-response" ) , msg ) ; } if ( ( authnInstant - this . processingConfig . getAllowedClockSkew ( ) ) > responseTime ) { final String msg = String . format ( "Invalid authentication instant (%d). It is after the SignResponse time (%d) [request-id='%s']" , authnInstant , responseTime , signRequest . getRequestID ( ) ) ; log . error ( "{}: {}" , CorrelationID . id ( ) , msg ) ; throw new SignResponseProcessingException ( new ErrorCode . Code ( "invalid-response" ) , msg ) ; } return authnInstant ; }
Validates that the received authentication instant is OK.
Validates that the received authentication instant is OK .