forked from elastic/integrations
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[okta] Add system tests (elastic#1034)
* Add system tests * Use new mock server
- Loading branch information
Showing
10 changed files
with
265 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
version: '2.3' | ||
services: | ||
okta: | ||
image: alpine | ||
image: docker.elastic.co/observability/stream:v0.5.0 | ||
ports: | ||
- 8080 | ||
volumes: | ||
- ./sample_logs:/sample_logs:ro | ||
- ${SERVICE_LOGS_DIR}:/var/log | ||
command: /bin/sh -c "cp /sample_logs/* /var/log/" | ||
- ./files:/files:ro | ||
environment: | ||
PORT: 8080 | ||
command: | ||
- http-server | ||
- --addr=:8080 | ||
- --config=/files/config.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,225 @@ | ||
rules: | ||
- path: /api/v1/logs | ||
methods: ["GET"] | ||
request_headers: | ||
authorization: "SSWS testing" | ||
query_params: | ||
since: "{since:.*}" | ||
responses: | ||
- status_code: 200 | ||
headers: | ||
Link: | ||
- '<http://{{ hostname }}:{{ env "PORT" }}/api/v1/logs?after=1>; rel="next"' | ||
- '<https://{{ hostname }}:{{ env "PORT" }}/api/v1/logs?since={{ .request.vars.since }}>; rel="self"' | ||
body: |- | ||
[ | ||
{ | ||
"actor": { | ||
"alternateId": "[email protected]", | ||
"detailEntry": null, | ||
"displayName": "xxxxxx", | ||
"id": "00u1abvz4pYqdM8ms4x6", | ||
"type": "User" | ||
}, | ||
"authenticationContext": { | ||
"authenticationProvider": null, | ||
"authenticationStep": 0, | ||
"credentialProvider": null, | ||
"credentialType": null, | ||
"externalSessionId": "102nZHzd6OHSfGG51vsoc22gw", | ||
"interface": null, | ||
"issuer": null | ||
}, | ||
"client": { | ||
"device": "Computer", | ||
"geographicalContext": { | ||
"city": "Dublin", | ||
"country": "United States", | ||
"geolocation": { | ||
"lat": 37.7201, | ||
"lon": -121.919 | ||
}, | ||
"postalCode": "94568", | ||
"state": "California" | ||
}, | ||
"id": null, | ||
"ipAddress": "108.255.197.247", | ||
"userAgent": { | ||
"browser": "FIREFOX", | ||
"os": "Mac OS X", | ||
"rawUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:72.0) Gecko/20100101 Firefox/72.0" | ||
}, | ||
"zone": "null" | ||
}, | ||
"debugContext": { | ||
"debugData": { | ||
"authnRequestId": "XkcAsWb8WjwDP76xh@1v8wAABp0", | ||
"requestId": "XkccyyMli2Uay2I93ZgRzQAAB0c", | ||
"requestUri": "/login/signout", | ||
"threatSuspected": "false", | ||
"url": "/login/signout?message=login_page_messages.session_has_expired" | ||
} | ||
}, | ||
"displayMessage": "User logout from Okta", | ||
"eventType": "user.session.end", | ||
"legacyEventType": "core.user_auth.logout_success", | ||
"outcome": { | ||
"reason": null, | ||
"result": "SUCCESS" | ||
}, | ||
"published": "2020-02-14T22:18:51.843Z", | ||
"request": { | ||
"ipChain": [ | ||
{ | ||
"geographicalContext": { | ||
"city": "Dublin", | ||
"country": "United States", | ||
"geolocation": { | ||
"lat": 37.7201, | ||
"lon": -121.919 | ||
}, | ||
"postalCode": "94568", | ||
"state": "California" | ||
}, | ||
"ip": "108.255.197.247", | ||
"source": null, | ||
"version": "V4" | ||
} | ||
] | ||
}, | ||
"securityContext": { | ||
"asNumber": null, | ||
"asOrg": null, | ||
"domain": null, | ||
"isProxy": null, | ||
"isp": null | ||
}, | ||
"severity": "INFO", | ||
"target": null, | ||
"transaction": { | ||
"detail": {}, | ||
"id": "XkccyyMli2Uay2I93ZgRzQAAB0c", | ||
"type": "WEB" | ||
}, | ||
"uuid": "faf7398a-4f77-11ea-97fb-5925e98228bd", | ||
"version": "0" | ||
}, | ||
{ | ||
"actor": { | ||
"alternateId": "[email protected]", | ||
"detailEntry": null, | ||
"displayName": "xxxxxx", | ||
"id": "00u1abvz4pYqdM8ms4x6", | ||
"type": "User" | ||
}, | ||
"authenticationContext": { | ||
"authenticationProvider": null, | ||
"authenticationStep": 0, | ||
"credentialProvider": null, | ||
"credentialType": null, | ||
"externalSessionId": "102bZDNFfWaQSyEZQuDgWt-uQ", | ||
"interface": null, | ||
"issuer": null | ||
}, | ||
"client": { | ||
"device": "Computer", | ||
"geographicalContext": { | ||
"city": "Dublin", | ||
"country": "United States", | ||
"geolocation": { | ||
"lat": 37.7201, | ||
"lon": -121.919 | ||
}, | ||
"postalCode": "94568", | ||
"state": "California" | ||
}, | ||
"id": null, | ||
"ipAddress": "108.255.197.247", | ||
"userAgent": { | ||
"browser": "FIREFOX", | ||
"os": "Mac OS X", | ||
"rawUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:72.0) Gecko/20100101 Firefox/72.0" | ||
}, | ||
"zone": "null" | ||
}, | ||
"debugContext": { | ||
"debugData": { | ||
"deviceFingerprint": "541daf91d15bef64a7e08c946fd9a9d0", | ||
"requestId": "XkcAsWb8WjwDP76xh@1v8wAABp0", | ||
"requestUri": "/api/v1/authn", | ||
"threatSuspected": "false", | ||
"url": "/api/v1/authn?" | ||
} | ||
}, | ||
"displayMessage": "User login to Okta", | ||
"eventType": "user.session.start", | ||
"legacyEventType": "core.user_auth.login_success", | ||
"outcome": { | ||
"reason": null, | ||
"result": "SUCCESS" | ||
}, | ||
"published": "2020-02-14T20:18:57.718Z", | ||
"request": { | ||
"ipChain": [ | ||
{ | ||
"geographicalContext": { | ||
"city": "Dublin", | ||
"country": "United States", | ||
"geolocation": { | ||
"lat": 37.7201, | ||
"lon": -121.919 | ||
}, | ||
"postalCode": "94568", | ||
"state": "California" | ||
}, | ||
"ip": "108.255.197.247", | ||
"source": null, | ||
"version": "V4" | ||
} | ||
] | ||
}, | ||
"securityContext": { | ||
"asNumber": null, | ||
"asOrg": null, | ||
"domain": null, | ||
"isProxy": null, | ||
"isp": null | ||
}, | ||
"severity": "INFO", | ||
"target": null, | ||
"transaction": { | ||
"detail": {}, | ||
"id": "XkcAsWb8WjwDP76xh@1v8wAABp0", | ||
"type": "WEB" | ||
}, | ||
"uuid": "3aeede38-4f67-11ea-abd3-1f5d113f2546", | ||
"version": "0" | ||
} | ||
] | ||
- path: /api/v1/logs | ||
methods: ["GET"] | ||
request_headers: | ||
authorization: "SSWS testing" | ||
query_params: | ||
after: "1" | ||
responses: | ||
- status_code: 200 | ||
headers: | ||
Link: | ||
- '<http://{{ hostname }}:{{ env "PORT" }}/api/v1/logs?after=2>; rel="next"' | ||
- '<https://{{ hostname }}:{{ env "PORT" }}/api/v1/logs?after=1>; rel="self"' | ||
body: "[\n { \n \"actor\": {\n \"alternateId\": \"[email protected]\",\n \"detailEntry\": null,\n \"displayName\": \"xxxxxx\",\n \"id\": \"00u1abvz4pYqdM8ms4x6\",\n \"type\": \"User\"\n },\n \"authenticationContext\": {\n \"authenticationProvider\": null,\n \"authenticationStep\": 0,\n \"credentialProvider\": null,\n \"credentialType\": null,\n \"externalSessionId\": \"102bZDNFfWaQSyEZQuDgWt-uQ\",\n \"interface\": null,\n \"issuer\": null\n },\n \"client\": {\n \"device\": \"Computer\",\n \"geographicalContext\": {\n \"city\": \"Dublin\",\n \"country\": \"United States\",\n \"geolocation\": {\n \"lat\": 37.7201,\n \"lon\": -121.919\n },\n \"postalCode\": \"94568\",\n \"state\": \"California\"\n },\n \"id\": null,\n \"ipAddress\": \"108.255.197.247\",\n \"userAgent\": {\n \"browser\": \"FIREFOX\",\n \"os\": \"Mac OS X\",\n \"rawUserAgent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:72.0) Gecko/20100101 Firefox/72.0\"\n },\n \"zone\": \"null\"\n },\n \"debugContext\": {\n \"debugData\": {\n \"deviceFingerprint\": \"541daf91d15bef64a7e08c946fd9a9d0\",\n \"requestId\": \"XkcAsWb8WjwDP76xh@1v8wAABp0\",\n \"requestUri\": \"/api/v1/authn\",\n \"threatSuspected\": \"false\",\n \"url\": \"/api/v1/authn?\"\n }\n },\n \"displayMessage\": \"Evaluation of sign-on policy\",\n \"eventType\": \"policy.evaluate_sign_on\",\n \"legacyEventType\": null,\n \"outcome\": {\n \"reason\": \"Sign-on policy evaluation resulted in ALLOW\",\n \"result\": \"ALLOW\"\n },\n \"published\": \"2020-02-14T20:18:57.762Z\",\n \"request\": {\n \"ipChain\": [\n {\n \"geographicalContext\": {\n \"city\": \"Dublin\",\n \"country\": \"United States\",\n \"geolocation\": {\n \"lat\": 37.7201,\n \"lon\": -121.919\n },\n \"postalCode\": \"94568\",\n \"state\": \"California\"\n },\n \"ip\": \"108.255.197.247\",\n \"source\": null,\n \"version\": \"V4\"\n }\n ]\n },\n \"securityContext\": {\n \"asNumber\": null,\n \"asOrg\": null,\n \"domain\": null,\n \"isProxy\": null,\n \"isp\": null\n },\n \"severity\": \"INFO\",\n \"target\": [\n {\n \"alternateId\": \"unknown\",\n \"detailEntry\": {\n \"policyType\": \"OktaSignOn\"\n },\n \"displayName\": \"Default Policy\",\n \"id\": \"00p1abvweGGDW10Ur4x6\",\n \"type\": \"PolicyEntity\"\n },\n {\n \"alternateId\": \"00p1abvweGGDW10Ur4x6\",\n \"detailEntry\": null,\n \"displayName\": \"Default Rule\",\n \"id\": \"0pr1abvwfqGFI4n064x6\",\n \"type\": \"PolicyRule\"\n }\n ],\n \"transaction\": {\n \"detail\": {},\n \"id\": \"XkcAsWb8WjwDP76xh@1v8wAABp0\",\n \"type\": \"WEB\"\n },\n \"uuid\": \"3af594f9-4f67-11ea-abd3-1f5d113f2546\",\n \"version\": \"0\"\n }\n]" | ||
- path: /api/v1/logs | ||
methods: ["GET"] | ||
request_headers: | ||
authorization: "SSWS testing" | ||
query_params: | ||
after: "2" | ||
responses: | ||
- status_code: 200 | ||
headers: | ||
Link: | ||
- '<http://{{ hostname }}:{{ env "PORT" }}/api/v1/logs?after=2>; rel="next"' | ||
- '<https://{{ hostname }}:{{ env "PORT" }}/api/v1/logs?after=2>; rel="self"' | ||
body: |- | ||
[] |
3 changes: 0 additions & 3 deletions
3
packages/okta/_dev/deploy/docker/sample_logs/okta-system.json.log
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 7 additions & 4 deletions
11
packages/okta/data_stream/system/_dev/test/system/test-default-config.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
input: logfile | ||
input: httpjson | ||
service: okta | ||
vars: | ||
keep_original_message: true | ||
paths: | ||
- "{{SERVICE_LOGS_DIR}}/*system*.log" | ||
url: http://{{Hostname}}:{{Port}}/api/v1/logs | ||
api_key: testing | ||
data_stream: | ||
vars: | ||
preserve_original_event: true |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.