Coder Social home page Coder Social logo

Comments (6)

SkaveRat avatar SkaveRat commented on July 21, 2024

an example for this would be usefull

from etcpasswdoauthbundle.

jalonsoa avatar jalonsoa commented on July 21, 2024

Please, would be great !

from etcpasswdoauthbundle.

SkaveRat avatar SkaveRat commented on July 21, 2024

after trying around with verious methods, I don't think it's easy to use this with FOSUserBundle.

And as the maintainer doesn't respond about anything here, I'll mark this repo as dead for me. I'll have to live with email auth for now...

from etcpasswdoauthbundle.

jalonsoa avatar jalonsoa commented on July 21, 2024

Hi !
finally, I can find a solution that work for me. I declare the fos_user as user provider on security.yml. Then I wrote an AuthenticationProvider (based on AuthenticationProvider from etcpasswdoauthbundle), with authenticate method thats make the trick.

    $data = $token->getResponse()->getJson();
    try {
        $user = $this->userProvider->loadUserByUsername($token->getUsername());
        // compare user properties with oauth data for updates
    } catch (UsernameNotFoundException $e) {
        // Create user with oauth data
    }

At last, configure the "etcpasswd_oauth.authentication.provider.oauth.class" as my AuthenticationProvider class

I hope that this help you !

j

from etcpasswdoauthbundle.

SkaveRat avatar SkaveRat commented on July 21, 2024

Sweet, thanks. Helped me a lot. As I'm just beginning with Sf2, where can I override the configuration of the AuthProvider Class without doing it in the OAuthBundle?

from etcpasswdoauthbundle.

jalonsoa avatar jalonsoa commented on July 21, 2024

In your bundle. For example:

src/Acme/YourBundle/Security/Core/Authentication/Provider/OAuthProvider.php (copy the OAuthProvider class from etcpasswd and develop from this)

Then in, your services.yml (or xml) src/Acme/YourBundle/Resources/config/services.yml define a parameter:

parameters:
    etcpasswd_oauth.authentication.provider.oauth.class: Acme\YourBundle\Security\Core\Authentication\Provider\OAuthProvider

j

from etcpasswdoauthbundle.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.