Giter Club home page Giter Club logo

alphagov.verify-event-emitter-loader's Introduction

Event Emitter Loader

Build

./gradlew build shadowJar

Configure

Create configuration file with structure:

eventEmitterConfiguration:
  enabled: true
  accessKeyId: <access key for calling API Gateway>
  secretAccessKey: <access key secret for calling API Gateway>
  region: eu-west-2
  encryptionKey: <encrypted key used to encrypt events (encypted using KMS)>
 

A template file is provided in configuration/eventloader.yml.template.

The template file allows you to specify the configuration using environment variables. You will need to set the following variables:

export EVENT_EMITTER_ENCRYPTION_KEY=<encrypted encryption key>
export EVENT_EMITTER_API_GATEWAY_URL=<URL to the SQS queue>
export API_GATEWAY_AWS_ACCESS_KEY_ID=<access key>
export API_GATEWAY_AWS_SECRET_ACCESS_KEY=<secret>
export AWS_REGION=eu-west-2

Running

Before running any of the below commands, you need to use the AWS CLI tools to authenticate.

You can use the tools/assume-role.py tool in the alphagov/verify-event-infrastructure repository, e.g.:

 eval $(../verify-event-infrastructure/tools/assume-role.py -t audit-billing-admin-dev -m <AWS OTP code>)

Create single event

To create a single event in the queue:

java -jar build/libs/event-creator-1.0-SNAPSHOT-all.jar create -t <event_type> -d '<session details as JSON >' -s "<session_id>" -o "<originating_service>" [ --timestamp "<timestamp as YYYY-MM-ddTHH:mm:ss.iiiZ>" ] -c <path to config file>

For example:

java -jar build/libs/event-creator-1.0-SNAPSHOT-all.jar create -t session_event -d '{"session_event_type": "idp_authn_success"}' -s "b6289a9f-1b01-49ec-b3be-cd0aa501e280" -o "policy" --timestamp "2019-01-01T06:30:00.000Z" -c configuration/eventloader.yml

The eventId is automatically generated and if not specified on the command line, the timestamp field will include the current date and time. All other fields must be included on the command line.

Load events from file

To load a set of pre-configured events you first need to produce a file containing an array of JSON representations of the events, for example:

[
  {
    "eventId": "b27fb3f0-c955-429d-9a53-e3ece111fd20",
    "timestamp": 1546324200000,
    "event_type": "session_event",
    "originating_service": "policy",
    "details": {
        "message_id": "_12345678901234567890ABCDEF123456",
        "request_id": "_12345678901234567890ABCDEF123456",
        "session_event_type": "session_started",
        "session_expiry_time": "2019-01-01T12:00:00.000Z",
        "transaction_entity_id": "https://idp-entity-id",
        "minimum_level_of_assurance": "LEVEL_2",
        "required_level_of_assurance": "LEVEL_2",
        "principal_ip_address_as_seen_by_hub": "111.222.222.111 10.0.0.1"
    }
  },
  {
    "eventId": "9b940355-36db-44b4-bee8-b13de18ae150",
     "timestamp": 1546324200000,
     "event_type": "session_event",
     "originating_service": "policy",
     "details": {
         "message_id": "_12345678901234567890ABCDEF123456",
         "request_id": "_12345678901234567890ABCDEF123456",
         "session_event_type": "idp_selected",
         "session_expiry_time": "2019-01-01T12:00:00.000Z",
         "transaction_entity_id": "https://idp-entity-id",
         "minimum_level_of_assurance": "LEVEL_2",
         "required_level_of_assurance": "LEVEL_2",
         "principal_ip_address_as_seen_by_hub": "111.222.222.111 10.0.0.1"
     }
   }
]

alphagov.verify-event-emitter-loader's People

Contributors

chrisclayson avatar jhjava avatar krenair avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.