Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
User implementation, DB storage but with auth via API
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  11 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Chris Sedlmayr  
View profile  
 More options Feb 23 2012, 4:31 pm
From: Chris Sedlmayr <ch...@sedlmayr.co.uk>
Date: Thu, 23 Feb 2012 13:31:10 -0800 (PST)
Local: Thurs, Feb 23 2012 4:31 pm
Subject: User implementation, DB storage but with auth via API

Hi all,

I've been going through lots of official docs, code and articles to work
out the best way to do this, but would like some advice.

I will have a local DB users table connected via Doctrine.
When a user logs in, username + password, I must authenticate them via an
API (it implements an ACL).
If successful I should create them in the local DB (or update if existing
user is logging in).

I've been
through http://symfony.com/doc/2.0/cookbook/security/custom_authentication_pr...
but think a lot of this doesn't apply.
And
also http://php-and-symfony.matthiasnoback.nl/2011/10/symfony2-how-to-crea...
which is closer to the mark, but I still am unsure specifically what parts
of the whole system I need to do.

I need a User Entity in order to hold the user details once authenticated
and persist to the DB.
I need a User Provider which will take the entered details, make a call to
the API and return the result of the authentication request.
Do I also need a User class to represent a user as returned by the API,
then I would get data from this, and set into the User Entity?

As always, typing this out I think has helped, but I would appreciate if
anyone could confirm or advise otherwise?

Many thanks,
Chris


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Sedlmayr  
View profile  
 More options Feb 24 2012, 6:21 am
From: Chris Sedlmayr <ch...@sedlmayr.co.uk>
Date: Fri, 24 Feb 2012 03:21:53 -0800 (PST)
Local: Fri, Feb 24 2012 6:21 am
Subject: Re: User implementation, DB storage but with auth via API

Still a bit stuck here;

I'm not sure where the actual auth call to the API should be, of course
there is a loadByUsername() function in my UserProvider class, but this is
only to load the user, not authenticate using the password.
The auth must be done at the API level, the API does not return a password
for me to compare, I pass it a password and it does the check then returns
to me the result of the check.

How should I implement this?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
marcoiai  
View profile   Translate to Translated (View Original)
 More options Aug 23 2012, 4:33 pm
From: marcoiai <marco.a.si...@gmail.com>
Date: Thu, 23 Aug 2012 13:33:21 -0700 (PDT)
Local: Thurs, Aug 23 2012 4:33 pm
Subject: Re: User implementation, DB storage but with auth via API

Hi. Its seamless. All you need to do is implement UserInterface.

There you will return your field that act as username and password, above
other fields (check provided links at the bottom).

Then, at your security.yml, theres a section like this (only to ilustrate
the example):

providers:
        administrators:
            entity: { class: EnovaEntitiesBundle:Entidades, property:
usuario }

secured_area:
            pattern:    ^/
            form_login:
                intention:  authenticate
                check_path: /login_check
                login_path: /login
                failure_path: /login
                default_target_path: /agenda
                always_use_default_target_path: true
                username_parameter:   usuario
                password_parameter:   senha

Look like i changed password_parameter to "senha", my field that holds the
password. The key here is the config of security.yml. You create a void
routing rule named /login_check, this is where the magic happens. The
security layer intercepts your call to login_check route (this is the url
that your login_form will post) and using your entity (in my case
EnovaEntitiesBundle:Entidades) will do the password check for you. Dont
forget to mantain one firewall to all configuration of security.yml.

Read these links:
http://symfony.com/doc/current/cookbook/security/entity_provider.html
http://symfony.com/doc/current/book/security.html
http://symfony.com/doc/current/cookbook/security/form_login.html

Em sexta-feira, 24 de fevereiro de 2012 09h21min53s UTC-2, Chris Sedlmayr
escreveu:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Sedlmayr  
View profile  
 More options Aug 24 2012, 3:48 am
From: Chris Sedlmayr <ch...@sedlmayr.co.uk>
Date: Fri, 24 Aug 2012 08:48:04 +0100
Local: Fri, Aug 24 2012 3:48 am
Subject: Re: [Symfony2] Re: User implementation, DB storage but with auth via API

Hey,

Yeah, it's all much clearer now, spent some time with Johannes to
understand some of the internals of the security component.
It really helps to understand the actual code under the hood, rather than
just what you should do to make something work.

We are doing a little more than described here, am trying to find time to
document it, but this should do for most people for now.

Thanks,
Chris

On 23 August 2012 21:33, marcoiai <marco.a.si...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marco Aurélio Simão  
View profile   Translate to Translated (View Original)
 More options Aug 24 2012, 8:04 am
From: Marco Aurélio Simão <marco.a.si...@gmail.com>
Date: Fri, 24 Aug 2012 09:04:07 -0300
Local: Fri, Aug 24 2012 8:04 am
Subject: Re: [Symfony2] Re: User implementation, DB storage but with auth via API

Glad this could help, as im find myself many times stuck with one of these
hehehehehehe

atenciosamente,
Marco Aurélio Simão

2012/8/24 Chris Sedlmayr <ch...@sedlmayr.co.uk>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paulo Rodrigues Pinto  
View profile  
 More options Aug 29 2012, 9:15 pm
From: Paulo Rodrigues Pinto <regularj...@gmail.com>
Date: Wed, 29 Aug 2012 18:15:34 -0700 (PDT)
Local: Wed, Aug 29 2012 9:15 pm
Subject: Re: [Symfony2] Re: User implementation, DB storage but with auth via API

Hey Chris

I have the exact same requirement as you: performing the authentication at
an external API level, which does not return me a password but only whether
the authentication was successful or not.

I've been going through a lot of documentation to find out how to do this
until I found this thread. Would you mind giving me some pointers on how
you implemented this?

Thanks,
Paulo


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Sedlmayr  
View profile  
 More options Aug 30 2012, 2:54 pm
From: Chris Sedlmayr <ch...@sedlmayr.co.uk>
Date: Thu, 30 Aug 2012 11:54:04 -0700 (PDT)
Local: Thurs, Aug 30 2012 2:54 pm
Subject: Re: [Symfony2] Re: User implementation, DB storage but with auth via API

Hi Paulo,

Not at all, it's probably best if I document exactly what i've done
including code, makes for a clearer explanation.
I wrote it in 2.0, but have since upgraded it to 2.1, which are you using?

Chris


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paulo Rodrigues Pinto  
View profile  
 More options Aug 30 2012, 4:27 pm
From: Paulo Rodrigues Pinto <regularj...@gmail.com>
Date: Thu, 30 Aug 2012 13:27:07 -0700 (PDT)
Local: Thurs, Aug 30 2012 4:27 pm
Subject: Re: [Symfony2] Re: User implementation, DB storage but with auth via API

Great! I'm kind of blocked on this so I very much appreciate it.

I'm using 2.1.

Paulo


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Sedlmayr  
View profile  
 More options Sep 4 2012, 9:50 am
From: Chris Sedlmayr <ch...@sedlmayr.co.uk>
Date: Tue, 4 Sep 2012 06:50:50 -0700 (PDT)
Local: Tues, Sep 4 2012 9:50 am
Subject: Re: [Symfony2] Re: User implementation, DB storage but with auth via API

Hey,

Just wanted to let you know i've started writing this up.
In between work and other commitments I should have it done (first draft)
in a couple of days.

Will post it then and can get feedback on clarity.

Chris


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paulo Rodrigues Pinto  
View profile  
 More options Sep 4 2012, 12:21 pm
From: Paulo Rodrigues Pinto <regularj...@gmail.com>
Date: Tue, 4 Sep 2012 12:20:59 -0400
Local: Tues, Sep 4 2012 12:20 pm
Subject: Re: [Symfony2] Re: User implementation, DB storage but with auth via API

No problem Chris. I'm looking forward to give you some feedback on that.

Thanks for the update,
Paulo

On Tue, Sep 4, 2012 at 10:50 AM, Chris Sedlmayr <ch...@sedlmayr.co.uk>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Sedlmayr  
View profile  
 More options Oct 12 2012, 11:48 am
From: Chris Sedlmayr <ch...@sedlmayr.co.uk>
Date: Fri, 12 Oct 2012 08:48:50 -0700 (PDT)
Local: Fri, Oct 12 2012 11:48 am
Subject: Re: [Symfony2] Re: User implementation, DB storage but with auth via API

Hi,

So to update, we are working on a complete article that I hope to add the
the official docs for a wider audience.
But for now you can hopefully see what you need to fill the gaps from my
first draft of the entry.

https://github.com/catchamonkey/catchamonkey.github.com/pull/7/files

Hope that helps!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »