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

Add simple user provider #72

Merged
merged 3 commits into from
Jan 8, 2018

Conversation

thewilkybarkid
Copy link
Contributor

This add a user provider that can be used for simple authentication use cases, allowing any successful OAuth to authenticate into your app without any persistence.

(This is similar to the other bundle.)

Copy link
Member

@weaverryan weaverryan left a comment

Choose a reason for hiding this comment

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

Hey @thewilkybarkid!

Very interesting! Could you take a quick try to add something to the docs about this? I can put any finishing touches on it :).

public function supportsClassProvider()
{
yield 'OAuthUser' => [OAuthUser::class, true];
yield 'other user' => [SomeUser::class, false];
Copy link
Member

Choose a reason for hiding this comment

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

Could you use a UserInterface mock instead of creating the stub class below?

{
private $roles;

public function __construct(array $roles = ['ROLE_USER', 'ROLE_OAUTH_USER'])
Copy link
Member

Choose a reason for hiding this comment

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

I noticed this wasn't actually configurable in the service. And... I'm not sure if it should be anyways :). After all, this is a helper class to make things easy... and not something the user is bound to. With this setup, they could just create their own service for this class. I'm just thinking aloud... I think like it how it is now

@thewilkybarkid
Copy link
Contributor Author

Had a stab at some documentation, hopefully it's clear enough but please change if not!

@weaverryan weaverryan merged commit d71a55f into knpuniversity:master Jan 8, 2018
@weaverryan
Copy link
Member

Great job! I made some minor tweaks, but you made my job easy :). I appreciate you taking the time to contribute back - and hopefully you can now make your linked PR a bit simpler - I just tagged 1.16.0.

@thewilkybarkid thewilkybarkid deleted the user-provider branch January 10, 2018 14:32
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