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

Auth0User uses private variables so they cannot be accessed or overridden in child class #120

Closed
cjd118 opened this issue Feb 13, 2019 · 1 comment · Fixed by #132
Closed
Milestone

Comments

@cjd118
Copy link

cjd118 commented Feb 13, 2019

Hi,

Auth0User declares $userInfo and $accessToken as private instead of protected.

This means our child class cannot override these values so we can't get getAuthIdentifier to return a different identifier (our use case being we don't want the locally stored user to have 'sub' as the column name and would prefer something more obvious like 'auth0_id' in the db users table).

e.g.

<?php

namespace Example\Users;

class ExampleUser extends \Auth0\Login\Auth0User
{
    public function getAuthIdentifier()
    {
		return $this->userInfo['auth0_id'];
    }
}

Is this something you can fix?

@joshcanhelp
Copy link
Contributor

@cjd118 - I see what you're saying here and I don't see any reason that couldn't be protected instead. I don't think we expected this class to be extended when it was written but I see how this would be helpful.

Give me some time to take a closer look to make sure I'm not missing anything and I can put through a PR for that. Thanks for the feedback!

@joshcanhelp joshcanhelp added this to the 5.1.1 milestone Jun 27, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants