Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
cortex: add GitHub OAuth configuration
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Sokołowski <[email protected]>
  • Loading branch information
jakubgs committed Nov 13, 2020
1 parent 9835031 commit d01e6f7
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
1 change: 0 additions & 1 deletion ansible/group_vars/thehive-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ cortex_search_nodes: |
# GitHub OAuth details
cortex_oauth_client_id: '{{ lookup("passwordstore", "services/TheHive-Cortex/OAuth/client-id") }}'
cortex_oauth_client_secret: '{{ lookup("passwordstore", "services/TheHive-Cortex/OAuth/client-secret") }}'
cortex_oauth_org_name: 'status-im'

# The Hive ---------------------------------------------------------------------
the_hive_domain: 'hive.status.im'
Expand Down
6 changes: 6 additions & 0 deletions ansible/roles/cortex/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
cortex_domain: ~

cortex_service_name: 'cortex'
cortex_service_user: 'cortex'

Expand Down Expand Up @@ -40,3 +42,7 @@ cortex_org_name: 'Status.im'
# User for TheHive API access
cortex_the_hive_user: 'thehive'
cortex_the_hive_pass: ~

# OAuth
cortex_oauth_client_id: ~
cortex_oauth_client_secret: ~
34 changes: 33 additions & 1 deletion ansible/roles/cortex/templates/application.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,42 @@ cache.job = 10 minutes

# Authentication
auth {
provider = [local]
provider = [
local,
{% if cortex_oauth_client_id is defined %}
oauth2,
{% endif %}
]
method {
basic = true
}
{% if cortex_oauth_client_id is defined %}
sso {
autocreate: false
autoupdate: false
mapper: "simple"
attributes {
login: "login"
name: "name"
roles: "role"
}
defaultRoles: ["read", "analyze"]
defaultOrganization: "{{ cortex_org_name }}"
}
oauth2 {
name: oauth2
clientId: "{{ cortex_oauth_client_id | mandatory }}"
clientSecret: "{{ cortex_oauth_client_secret | mandatory }}"
redirectUri: "https://{{ cortex_domain | mandatory }}/api/ssoLogin"
responseType: code
grantType: "authorization_code"
authorizationUrl: "https://github.com/login/oauth/authorize"
authorizationHeader: "token"
tokenUrl: "https://github.com/login/oauth/access_token"
userUrl: "https://api.github.com/user"
scope: ["user"]
}
{% endif %}
}

# ANALYZERS
Expand Down

0 comments on commit d01e6f7

Please sign in to comment.