Giter Site home page Giter Site logo

Comments (4)

hernandev avatar hernandev commented on May 26, 2024 1

Won't Fix

Ok, I've read your issue again, and here is why I've taken the decision to wont-fix the reported problem:

1. The retrieval of a given user is not the scope of this library.

Retrieving users based on their unique identifiers is a scope of Illuminate\Contracts\Auth\UserProvider

If you are using the default UserProvider, that one is Illuminate\Auth\EloquentUserProvider and here is a snippet of the exact method that does that:

    /**
     * Retrieve a user by their unique identifier.
     */
    public function retrieveById($identifier)
    {
        $model = $this->createModel();

        return $model->newQuery()
            ->where($model->getAuthIdentifierName(), $identifier)
            ->first();
    }

As you can notice here, it's a single where condition performed against the User model.

As you can also notice, the database table field is determined by the getAuthIdentifierName() method, which is provided in any model implementing the Illuminate\Contracts\Auth\Authenticatable interface.

So, you have some options here:

1.1. Replace the ID identifier.

Instead of using the id field, you may use the email field, by overriding the getAuthIdentifier() directly on your User model.

1.2. Extend the User Provider.

Following the Laravel documentation, you may be able to register your own resolver. The documentation can be found at this link: authentication#adding-custom-user-providers

2. Application specific design decision.

The decision to distribute the user's information was application based. In most cases I've seen, the user's database is centralized alongside the tenants' table.

It's not fair that I include possible breaking changes into a too specific use case.

By this reason, I'm ruling out this as a security breach on the library, since the use-case is not recommended or common.

Thank you, you may contact me at Telegram if you need help implementing the custom logic. It will be a pleasure to help you out.

For now, I'm closing this issue.

from laravel-jwt.

jonagoldman avatar jonagoldman commented on May 26, 2024

ping @hernandev

from laravel-jwt.

hernandev avatar hernandev commented on May 26, 2024

Makes sense to me, let me check on this right now, and get back here.

from laravel-jwt.

jonagoldman avatar jonagoldman commented on May 26, 2024

I understand. Will try the options you suggested. Thanks!

from laravel-jwt.

Related Issues (20)

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.