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

fixes #3493 - check if auto user reg is allowed for auth source #1031

Closed

Conversation

stbenjam
Copy link
Member

source.onthefly_register wasn't checked anywhere, so ldap users were always automatically registered.

@stbenjam
Copy link
Member Author

There is checking of onthefly_register in auth_source_ldap but this is faulty. The user is auto-created created, just without any information like name, e-mail, etc. because of this:

https://github.com/theforeman/foreman/blob/develop/app/models/auth_sources/auth_source_ldap.rb?#L112

I think try_to_auto_create_user method is the better place to check anyway?

@ohadlevy
Copy link
Member

[test]

@@ -0,0 +1,8 @@
class AuthSourceDummy < AuthSource

def authenticate(login, password)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should move into a fixture / test/ mocking etc?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes... I hadn't worked with ruby mocking/stubbing before but it was easier than I thought. I also added logging when authentication succeeds but the user isn't auto-created.

Is that better?

@ohadlevy
Copy link
Member

[test]

@stbenjam
Copy link
Member Author

Can you retest? Rebased because of #1036

@skottler
Copy link

[test]

1 similar comment
@stbenjam
Copy link
Member Author

[test]

@domcleal
Copy link
Contributor

Merged as ccd9e52 for Foreman 1.4.0, thanks @stbenjam!

@domcleal domcleal closed this Nov 20, 2013
@stbenjam stbenjam deleted the 3493-ldap-autocreate-fix branch May 14, 2014 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants