formapro / FpOpenIdBundle

Symfony2 OpenID security extension
53 stars 31 forks source link

Examples needed #62

Closed romaricdrigon closed 11 years ago

romaricdrigon commented 11 years ago

Hi,

I'm trying to implement it over an existing Symfony2 application. This bundle is great, however I find it lacks one or two examples: following the doc is easy, but it really misses one or two examples of UserProvider. I had a hard time figuring out the process (never used OpenID before I admit; however for example thinking than I could request contact/email...). If some users want to post some code snippets, I would appreciate so much!

In return, if I can get it working, I'm not opposed to help enhancing the doc of course :-)

Thanks

makasim commented 11 years ago

Since the bundle is extension of security component\bundle. Some knowledge is required to understand what is written in the doc.

I had a hard time figuring out the process

As I get from this message. So general workflow doc is missing, yes?

but it really misses one or two examples of UserProvider

Can you point me out which parts of the UserProvider doc (or the other doc) is not clear? or miss some details?

however for example thinking than I could request contact/email...

Sorry dont get this. I are you talking about ability to request personal info from user provider? If so, yes it is possible. You have to set required_attributes. See notes that some providers could return nothing.

romaricdrigon commented 11 years ago

Yes, a general workflow doc would be very useful.

Just a few diagrams could make the difference: my app already had an authentification (using DB entities), roles and business-rules (kind of ACLs), so I was ok about Symfony2 security objects, but figuring out how to link both is the uneasy part (for example, when will I create an OpenIdIdentity object in the database?).

There's also a small typo in the doc: in configure_user_manager.md, Step 1, a), you can believe the OpenIdIdentity is an user (I'll create a PR with suggestions for the doc latter).

The hard part (at least for me) is what the createUserFromIdentity method in UserManager can contains (and should): I'm used to work with controllers, TwigExtensions, services, but for example how can I get an EntityManager to fetch the corresponding User in the database? Which exceptions should I handle? Also, what are the differences with loadUserFromIdentity?

romaricdrigon commented 11 years ago

Well, I finally get it. I forget it for a few days, and when I was back I realized my mistakes.

I'll send you a PR about some ameliorations for the documentation.