Skip to content

[Ldap] Add security LdapUser and provider #32824

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

Merged
merged 1 commit into from
Aug 5, 2019
Merged

Conversation

chalasr
Copy link
Member

@chalasr chalasr commented Jul 31, 2019

Q A
Branch? 4.4
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? yes
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

Moves LdapUserProvider from Security\Core to the Ldap component, the provider now deals with a new LdapUser aware of its ldap Entry (should help in #31843).

@Simperfit
Copy link
Contributor

Travis failure is unrelated

/**
* @author Robin Chalas <robin.chalas@gmail.com>
*
* @internal
Copy link
Member

Choose a reason for hiding this comment

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

is this a requirement? do we anticipate possible direct use in userland?

Copy link
Contributor

Choose a reason for hiding this comment

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

People have been using the InMemoryUser (aka User) in user-land as well, albeit having a more generic name, I think it's good to mention that this is (package) internal.

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, the security-core User should be internal since day 1 to me. Reasoning is that UserInterface should be the only core type needed in userland.
But, given this one exposes a getExtraFields() introduced not so long ago (#31532), I switched to just @final.

Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be an option to move those to the token attributes instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

they are about domain user info such as email address, phone number... so not sure actually. If I had to use this provider, I would probably write a user class with proper getters and build it from the LdapUser

Copy link
Contributor

Choose a reason for hiding this comment

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

If you'd not have the user object outside of the inner security workings anymore, thus move it to just the domain object, how would you solve that for LDAP?

Copy link
Contributor

@linaori linaori left a comment

Choose a reason for hiding this comment

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

This is a really nice change, 1 less usage of the User!

/**
* @author Robin Chalas <robin.chalas@gmail.com>
*
* @internal
Copy link
Contributor

Choose a reason for hiding this comment

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

People have been using the InMemoryUser (aka User) in user-land as well, albeit having a more generic name, I think it's good to mention that this is (package) internal.

@chalasr chalasr force-pushed the ldap-user branch 2 times, most recently from 990ffd9 to 18b4354 Compare August 1, 2019 15:11
@chalasr
Copy link
Member Author

chalasr commented Aug 1, 2019

Comments addressed, thanks for the reviews

@fabpot
Copy link
Member

fabpot commented Aug 5, 2019

Thank you @chalasr.

@fabpot fabpot merged commit 6736cdf into symfony:4.4 Aug 5, 2019
fabpot added a commit that referenced this pull request Aug 5, 2019
This PR was merged into the 4.4 branch.

Discussion
----------

[Ldap] Add security LdapUser and provider

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Moves `LdapUserProvider` from `Security\Core` to the Ldap component, the provider now deals with a new `LdapUser` aware of its ldap `Entry` (should help in #31843).

Commits
-------

6736cdf [Ldap] Add security LdapUser and provider
@chalasr chalasr deleted the ldap-user branch August 5, 2019 06:08
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Oct 5, 2019
This PR was squashed before being merged into the 4.4 branch (closes #12423).

Discussion
----------

[Ldap] Add security LdapUser and provider (4.4)

#12088 and symfony/symfony#32824

![image](https://user-images.githubusercontent.com/1073881/66232348-ed53bd00-e6e8-11e9-9430-ccc5cc953c2f.png)

Commits
-------

a4ea784 [Ldap] Add security LdapUser and provider (4.4)
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.4 Oct 27, 2019
This was referenced Nov 12, 2019
chalasr added a commit that referenced this pull request Jun 10, 2020
This PR was squashed before being merged into the 4.4 branch (closes #37177).

Discussion
----------

[Ldap] fix refreshUser() ignoring extra_fields

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? |no
| Tickets       | -
| License       | MIT
| Doc PR        | -

While #31532 introduced `extra_fields` in general, #32824 later added `LdapUser` & `LdapUserProvider` and ignored `extra_fields` on `refreshUser()`.

This PR fixes `refreshUser()` and adds a test which makes sure, that the refreshed ldap user doesn't lose its default values.

Commits
-------

cb8f129 [Ldap] fix refreshUser() ignoring extra_fields
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants