forked from openstack/kolla-ansible
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support to OpenID Connect Authentication flow
This pull request adds support for the OpenID Connect authentication flow in Keystone and enables both ID and access token authentication flows. The ID token configuration is designed to allow users to authenticate via Horizon using an identity federation; whereas the Access token is used to allow users to authenticate in the OpenStack CLI using a federated user. Without this PR, if one wants to configure OpenStack to use identity federation, he/she needs to do a lot of configurations in the keystone, Horizon, and register quite a good number of different parameters using the CLI such as mappings, identity providers, federated protocols, and so on. Therefore, with this PR, we propose a method for operators to introduce/present the IdP's metadata to Kolla-ansible, and based on the presented metadata, Kolla-ansible takes care of all of the configurations to prepare OpenStack to work in a federated environment. Implements: blueprint add-openid-support Co-Authored-By: Jason Anderson <[email protected]> Change-Id: I0203a3470d7f8f2a54d5e126d947f540d93b8210 (cherry picked from commit f3fbe83)
- Loading branch information
1 parent
436da12
commit 114a209
Showing
17 changed files
with
951 additions
and
13 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
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
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
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
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
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,86 @@ | ||
--- | ||
- name: Remove OpenID certificate and metadata files | ||
become: true | ||
vars: | ||
keystone: "{{ keystone_services['keystone'] }}" | ||
file: | ||
state: absent | ||
path: "{{ item }}" | ||
when: | ||
- inventory_hostname in groups[keystone.group] | ||
with_items: | ||
- "{{ keystone_host_federation_oidc_metadata_folder }}" | ||
- "{{ keystone_host_federation_oidc_idp_certificate_folder }}" | ||
- "{{ keystone_host_federation_oidc_attribute_mappings_folder }}" | ||
|
||
- name: Create OpenID configuration directories | ||
vars: | ||
keystone: "{{ keystone_services['keystone'] }}" | ||
file: | ||
dest: "{{ item }}" | ||
state: "directory" | ||
mode: "0770" | ||
become: true | ||
with_items: | ||
- "{{ keystone_host_federation_oidc_metadata_folder }}" | ||
- "{{ keystone_host_federation_oidc_idp_certificate_folder }}" | ||
- "{{ keystone_host_federation_oidc_attribute_mappings_folder }}" | ||
when: | ||
- inventory_hostname in groups[keystone.group] | ||
|
||
- name: Copying OpenID Identity Providers metadata | ||
vars: | ||
keystone: "{{ keystone_services['keystone'] }}" | ||
become: true | ||
copy: | ||
src: "{{ item.metadata_folder }}/" | ||
dest: "{{ keystone_host_federation_oidc_metadata_folder }}" | ||
mode: "0660" | ||
with_items: "{{ keystone_identity_providers }}" | ||
when: | ||
- item.protocol == 'openid' | ||
- inventory_hostname in groups[keystone.group] | ||
|
||
- name: Copying OpenID Identity Providers certificate | ||
vars: | ||
keystone: "{{ keystone_services['keystone'] }}" | ||
become: true | ||
copy: | ||
src: "{{ item.certificate_file }}" | ||
dest: "{{ keystone_host_federation_oidc_idp_certificate_folder }}" | ||
mode: "0660" | ||
with_items: "{{ keystone_identity_providers }}" | ||
when: | ||
- item.protocol == 'openid' | ||
- inventory_hostname in groups[keystone.group] | ||
|
||
- name: Copying OpenStack Identity Providers attribute mappings | ||
vars: | ||
keystone: "{{ keystone_services['keystone'] }}" | ||
become: true | ||
copy: | ||
src: "{{ item.file }}" | ||
dest: "{{ keystone_host_federation_oidc_attribute_mappings_folder }}/{{ item.file | basename }}" | ||
mode: "0660" | ||
with_items: "{{ keystone_identity_mappings }}" | ||
when: | ||
- inventory_hostname in groups[keystone.group] | ||
|
||
- name: Setting the certificates files variable | ||
become: true | ||
vars: | ||
keystone: "{{ keystone_services['keystone'] }}" | ||
find: | ||
path: "{{ keystone_host_federation_oidc_idp_certificate_folder }}" | ||
pattern: "*.pem" | ||
register: certificates_path | ||
when: | ||
- inventory_hostname in groups[keystone.group] | ||
|
||
- name: Setting the certificates variable | ||
vars: | ||
keystone: "{{ keystone_services['keystone'] }}" | ||
set_fact: | ||
keystone_federation_openid_certificate_key_ids: "{{ certificates_path.files | map(attribute='path') | map('regex_replace', '^.*/(.*)\\.pem$', '\\1#' + keystone_container_federation_oidc_idp_certificate_folder + '/\\1.pem') | list }}" # noqa 204 | ||
when: | ||
- inventory_hostname in groups[keystone.group] |
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
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
Oops, something went wrong.