Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle user attributes of type list #74

Closed
tarunpaul opened this issue Jan 11, 2019 · 7 comments
Closed

Handle user attributes of type list #74

tarunpaul opened this issue Jan 11, 2019 · 7 comments

Comments

@tarunpaul
Copy link
Contributor

tarunpaul commented Jan 11, 2019

The ValidationResponse should handle list attributes.

https://apereo.github.io/cas/4.2.x/protocol/CAS-Protocol-Specification.html#257-example-response-with-custom-attributes

{
  "serviceResponse" : {
    "authenticationSuccess" : {
      "user" : "username",
      "proxyGrantingTicket" : "PGTIOU-84678-8a9d...",
      "proxies" : [ "https://proxy1/pgtUrl", "https://proxy2/pgtUrl" ],
      "attributes" : {
        "firstName" : "John",
       "affiliation" : [ "staff", "faculty" ]
        "title" : "Mr.",
        "email" : "jdoe@example.orgmailto:jdoe@example.org",
        "lastname" : "Doe"
      }
    }
  }
}
  <cas:serviceResponse xmlns:cas="http://www.yale.edu/tp/cas">
    <cas:authenticationSuccess>
      <cas:user>username</cas:user>
      <cas:attributes>
        <cas:firstname>John</cas:firstname>
        <cas:lastname>Doe</cas:lastname>
        <cas:title>Mr.</cas:title>
        <cas:email>jdoe@example.org</cas:email>
        <cas:affiliation>staff</cas:affiliation>
        <cas:affiliation>faculty</cas:affiliation>
      </cas:attributes>
      <cas:proxyGrantingTicket>PGTIOU-84678-8a9d...</cas:proxyGrantingTicket>
    </cas:authenticationSuccess>
  </cas:serviceResponse>

"affiliation" : [ "staff", "faculty" ]
Should translate to

<cas:affiliation>staff</cas:affiliation>
<cas:affiliation>faculty</cas:affiliation>
@tarunpaul tarunpaul changed the title Handle user attribute list Handle user list attribute Jan 11, 2019
@tarunpaul tarunpaul changed the title Handle user list attribute Handle user attributes of type list Jan 11, 2019
@tarunpaul
Copy link
Contributor Author

I have created a pull request
#75

Please let me know if this looks ok.

@manelclos
Copy link
Collaborator

manelclos commented Jan 11, 2019

@tarunpaul thanks! I've taken a quick look and the PR is missing a test. I'd say that the for loop you created overwrites the attribute.text with the last value of the list. A test would prove me wrong ;)

Could you please add the test?

@tarunpaul
Copy link
Contributor Author

tarunpaul commented Jan 11, 2019

@manelclos I have added a test case. Please take a look.
And thank you for keeping up the code standards. Really appreciate it. :)

@tarunpaul
Copy link
Contributor Author

tarunpaul commented Jan 18, 2019

Hi @manelclos, Please let me know if this looks ok or if I have missed anything.
Few test environments seem to fail on travis-ci. Two of which are unable to connect to internet to download the specific python version.
But locally it seems to pass all test cases.

$ python3 runtest.py
Creating test database for alias 'default'...
Ran 157 tests in 1.767s
OK
Destroying test database for alias 'default'...

@manelclos
Copy link
Collaborator

@tarunpaul just checked the code locally, all good! Let's see if @jbittel has some time to approve it.

@tarunpaul
Copy link
Contributor Author

Great!
Thank you @manelclos :)

@jbittel
Copy link
Owner

jbittel commented Feb 7, 2019

Merged. Much appreciated!

@jbittel jbittel closed this as completed Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants