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

Making the user data fields mapping to Shibboleth variables configurable. #4

Merged
merged 4 commits into from
Sep 19, 2012
Merged

Conversation

TiagoTT
Copy link

@TiagoTT TiagoTT commented Sep 13, 2012

Hello!

I had to integrate an OSQA installation with our corporate Shibboleth authentication service and I used your module. Doing so I had to change the module's code to adjust the environment variable names, to suit my case. At the end I made these environment variable names configurable and this is the result.

I am not sure the changes in file "spec/omniauth/strategies/shibboleth_spec.rb" are correct, sorry about that. But the code I send you here is working fine for me and should work for everyone else.

I tried to keep compatibility with previous version by setting the default values of the new configuration variables to the old hardcoded values, except for the variable "uid_field" which was moved into the variable "fields" hash with key name "uid".

I have also changed the "README.md" to include an example for the new configuration.

Best regards.
Tiago

@toyokazu
Copy link
Owner

Thank you for your comment.
I agree with you to extend the code for flexibility.
However, I do not want to edit all field when I just edit uid field (e.g. just want to change eppn -> uid, but I also have to specify name field (required in omniauth) ;) ). Hash#merge may solve this problem. I would like to fix it, when I have a time ;) Please wait for a moment...

Anyway, thank you again for your comment :)

@TiagoTT
Copy link
Author

TiagoTT commented Sep 18, 2012

Hello again!

I tried to conciliate configuration flexibility with configuration variables independence, but I did not managed to merge the hash from config.fileds with the default, so I did it in a more practical way.

So now the three most important fields (uid, name and email) have their own configuration variables and any other can be mapped using the fields hash.

What do you think?

@TiagoTT TiagoTT closed this Sep 18, 2012
@TiagoTT TiagoTT reopened this Sep 18, 2012
@TiagoTT
Copy link
Author

TiagoTT commented Sep 18, 2012

Sorry about the Close and Reopen. My mouse tricked me.

toyokazu added a commit that referenced this pull request Sep 19, 2012
Making the user data fields mapping to Shibboleth variables configurable.
@toyokazu toyokazu merged commit 0c0ac42 into toyokazu:master Sep 19, 2012
@toyokazu
Copy link
Owner

Thank you for your contribution!

I like your approach.
I merged your codes and I just edit a bit.

  • I would like to delete email field from default options because Auth Hash Schema only require uid and name fields as default.
  • change :fields -> :info_fields because :name or :email fields are included "info" hash (by the way, "uid" is not included "info" hash)
  • reflect these changes to README.md
  • edit spec file for finishing tests normally

That's all.

I also update rubygems to 1.0.7. If you have any problem, please let me know.

Thank you again for your contributions :)

@TiagoTT
Copy link
Author

TiagoTT commented Sep 19, 2012

Welcome!

I am now trying to make GitLab changes get to upstream.
You can see here the new version in action:
gitlabhq/gitlabhq#1491

@toyokazu
Copy link
Owner

Thank you for your info!
I am glad to hear my trivial code can contribute your activities :)
I hope that your trial goes well.

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

Successfully merging this pull request may close these issues.

2 participants