Search in sources :

Example 1 with EventSinkHubEvent

use of uk.gov.ida.hub.policy.domain.EventSinkHubEvent in project verify-hub by alphagov.

the class HubEventLogger method logRequestFromHub.

public void logRequestFromHub(SessionId sessionId, String transactionEntityId) {
    Map<EventDetailsKey, String> details = new HashMap<>();
    details.put(hub_event_type, RECEIVED_AUTHN_REQUEST_FROM_HUB);
    details.put(transaction_entity_id, transactionEntityId);
    EventSinkHubEvent eventSinkHubEvent = new EventSinkHubEvent(serviceInfo, sessionId, HUB_EVENT, details);
    eventSinkProxy.logHubEvent(eventSinkHubEvent);
    eventEmitter.record(eventSinkHubEvent);
}
Also used : HashMap(java.util.HashMap) EventDetailsKey(uk.gov.ida.eventsink.EventDetailsKey) EventSinkHubEvent(uk.gov.ida.hub.policy.domain.EventSinkHubEvent)

Example 2 with EventSinkHubEvent

use of uk.gov.ida.hub.policy.domain.EventSinkHubEvent in project verify-hub by alphagov.

the class HubEventLogger method logSessionEvent.

private void logSessionEvent(SessionId sessionId, String transactionEntityId, DateTime sessionExpiryTimestamp, String requestId, String state, Map<EventDetailsKey, String> details) {
    LOG.info(MessageFormat.format("Session {0} moved to state {1}", sessionId.getSessionId(), state));
    details.put(session_event_type, state);
    details.put(session_expiry_time, sessionExpiryTimestamp.toString());
    details.put(transaction_entity_id, transactionEntityId);
    details.put(request_id, requestId);
    EventSinkHubEvent sessionHubEvent = new EventSinkHubEvent(serviceInfo, sessionId, SESSION_EVENT, details);
    eventSinkProxy.logHubEvent(sessionHubEvent);
    eventEmitter.record(sessionHubEvent);
}
Also used : EventSinkHubEvent(uk.gov.ida.hub.policy.domain.EventSinkHubEvent)

Example 3 with EventSinkHubEvent

use of uk.gov.ida.hub.policy.domain.EventSinkHubEvent in project verify-hub by alphagov.

the class HubEventLogger method logSessionTimeoutEvent.

public void logSessionTimeoutEvent(SessionId sessionId, DateTime sessionExpiryTimestamp, String transactionEntityId, String requestId) {
    Map<EventDetailsKey, String> details = new HashMap<>();
    details.put(session_event_type, SESSION_TIMEOUT);
    details.put(session_expiry_time, sessionExpiryTimestamp.toString());
    details.put(transaction_entity_id, transactionEntityId);
    details.put(request_id, requestId);
    EventSinkHubEvent eventSinkHubEvent = new EventSinkHubEvent(serviceInfo, sessionId, SESSION_EVENT, details);
    eventSinkProxy.logHubEvent(eventSinkHubEvent);
    eventEmitter.record(eventSinkHubEvent);
}
Also used : HashMap(java.util.HashMap) EventDetailsKey(uk.gov.ida.eventsink.EventDetailsKey) EventSinkHubEvent(uk.gov.ida.hub.policy.domain.EventSinkHubEvent)

Example 4 with EventSinkHubEvent

use of uk.gov.ida.hub.policy.domain.EventSinkHubEvent in project verify-hub by alphagov.

the class HubEventLogger method logErrorEvent.

private void logErrorEvent(final Map<EventDetailsKey, String> details, final SessionId sessionId) {
    final EventSinkHubEvent eventSinkHubEvent = new EventSinkHubEvent(serviceInfo, sessionId, EventSinkHubEventConstants.EventTypes.ERROR_EVENT, details);
    eventSinkProxy.logHubEvent(eventSinkHubEvent);
    eventEmitter.record(eventSinkHubEvent);
}
Also used : EventSinkHubEvent(uk.gov.ida.hub.policy.domain.EventSinkHubEvent)

Example 5 with EventSinkHubEvent

use of uk.gov.ida.hub.policy.domain.EventSinkHubEvent in project verify-hub by alphagov.

the class AwaitingCycle3DataStateControllerTest method cycle3dataInputCancelledFromFrontEnd_shouldLogCancellation.

@Test
public void cycle3dataInputCancelledFromFrontEnd_shouldLogCancellation() throws Exception {
    final String requestId = "requestId";
    final SessionId sessionId = aSessionId().build();
    final AwaitingCycle3DataStateController awaitingCycle3DataStateController = setUpAwaitingCycle3DataStateController(requestId, sessionId);
    awaitingCycle3DataStateController.handleCancellation();
    ArgumentCaptor<EventSinkHubEvent> argumentCaptor = ArgumentCaptor.forClass(EventSinkHubEvent.class);
    verify(eventSinkProxy, atLeastOnce()).logHubEvent(argumentCaptor.capture());
    Condition<EventSinkHubEvent> combinedConditions = AllOf.allOf(hasSessionId(sessionId), hasDetail(EventDetailsKey.session_event_type, CYCLE3_CANCEL), hasDetail(EventDetailsKey.request_id, requestId));
    assertThat(argumentCaptor.getAllValues()).haveAtLeast(1, combinedConditions);
}
Also used : SessionId(uk.gov.ida.hub.policy.domain.SessionId) SessionIdBuilder.aSessionId(uk.gov.ida.hub.policy.builder.domain.SessionIdBuilder.aSessionId) HasSessionId.hasSessionId(uk.gov.ida.hub.policy.matchers.HasSessionId.hasSessionId) EventSinkHubEvent(uk.gov.ida.hub.policy.domain.EventSinkHubEvent) Test(org.junit.Test)

Aggregations

EventSinkHubEvent (uk.gov.ida.hub.policy.domain.EventSinkHubEvent)26 Test (org.junit.Test)22 EventDetailsKey (uk.gov.ida.eventsink.EventDetailsKey)18 SessionId (uk.gov.ida.hub.policy.domain.SessionId)5 Matchers.anyString (org.mockito.Matchers.anyString)4 Cycle3MatchRequestSentStateBuilder.aCycle3MatchRequestSentState (uk.gov.ida.hub.policy.builder.state.Cycle3MatchRequestSentStateBuilder.aCycle3MatchRequestSentState)4 Cycle3MatchRequestSentState (uk.gov.ida.hub.policy.domain.state.Cycle3MatchRequestSentState)4 HashMap (java.util.HashMap)3 NoMatchFromMatchingService (uk.gov.ida.hub.policy.domain.NoMatchFromMatchingService)3 SessionIdBuilder.aSessionId (uk.gov.ida.hub.policy.builder.domain.SessionIdBuilder.aSessionId)2 StateTransitionAction (uk.gov.ida.hub.policy.domain.StateTransitionAction)2 HasSessionId.hasSessionId (uk.gov.ida.hub.policy.matchers.HasSessionId.hasSessionId)2 URI (java.net.URI)1 FraudDetectedDetailsBuilder.aFraudDetectedDetails (uk.gov.ida.hub.policy.builder.domain.FraudDetectedDetailsBuilder.aFraudDetectedDetails)1 MatchFromMatchingServiceBuilder.aMatchFromMatchingService (uk.gov.ida.hub.policy.builder.domain.MatchFromMatchingServiceBuilder.aMatchFromMatchingService)1 AttributeQueryRequestDto (uk.gov.ida.hub.policy.contracts.AttributeQueryRequestDto)1 SamlResponseWithAuthnRequestInformationDto (uk.gov.ida.hub.policy.contracts.SamlResponseWithAuthnRequestInformationDto)1 FraudDetectedDetails (uk.gov.ida.hub.policy.domain.FraudDetectedDetails)1 MatchFromMatchingService (uk.gov.ida.hub.policy.domain.MatchFromMatchingService)1 State (uk.gov.ida.hub.policy.domain.State)1