ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
14.06k stars 3.42k forks source link

Terrible API validation response when Dict expected in tower settings #2446

Open jlmitch5 opened 6 years ago

jlmitch5 commented 6 years ago

To reproduce, set this form value to valid json in the settings/auth form and save:

screen shot 2018-10-15 at 6 11 19 pm

Expected

Actual

screen shot 2018-10-15 at 6 11 27 pm
chrismeyersfsu commented 6 years ago

Upon further investigation, the API does accept json where a dict/json is expected. The confusing part is the crappy error message. If the json is of the expected structure and contains the expected key/values then it is accepted. If not, the unicode error message is returned. Below is an example of an expected payload.

{
    "SOCIAL_AUTH_AZUREAD_OAUTH2_ORGANIZATION_MAP":{"Default": {"admins": "true"}}
}
stenwt commented 5 years ago

This is present in AWX 2.1.0 deployed on OpenShift, using SAML auth. If I use the "Example SAML Team Map" verbatim from https://docs.ansible.com/ansible-tower/latest/html/administration/ent_auth.html#saml-authentication-settings I get the same error, likewise with { "foo" : "bar" }

chrismeyersfsu commented 5 years ago

@stenwt Tower docs are for tower. docs/* are for awx. We've updated awx/docs/auth/saml.md with a more cohesive example. Can you tell us if the saml.md example works for you?

sugitk commented 5 years ago

https://github.com/ansible/tower/blob/devel/awx/sso/conf.py#L1175-L1186

I think SocialTeamMapField should be SAMLTeamAttrField?