October: Laravel Authenticatable

Created on 8 Nov 2017  路  11Comments  路  Source: octobercms/october

I spoke with @LukeTowers on Slack and he's asked for me to create an issue on Github as a reminder and that he might be able to look in to it.

During a discussion with LukeTowers and Spunky on Slack about implementing Laravel Passport, the conclusion was that Laravel Authenticatable would need to be implemented within OC to allow for better integration with several Laravel Packages.

I know Spunky was hoping to have this resolved within a short period of time but due to other commitments, it's slipped - totally understandable.

Some links to help out.
https://laravel.com/api/5.5/Illuminate/Contracts/Auth/Authenticatable.html
https://laravel.com/docs/5.5/authentication
https://laravel.com/docs/5.5/passport

Slack Chat
https://octobercms.slack.com/archives/C09864473/p1508967798000074

I'm happy to donate a small sum to help kick start the implementation - won't be massive but it's something.

Cheers!

Medium In Progress Maintenance

Most helpful comment

This will come this summer as a part of the move to Laravel 5.9

All 11 comments

Yes, override the User model with your own. In fact, a plugin should be developed that does exactly this.

augmentblu [3:39 PM] 
@spunky does it make sense to just copy out the `Backend\Models\User` in to my own plugin and then use that for authenticating?

spunky [3:40 PM] 
Not quite, it makes sense to _extend_ `Backend\Models\User`

augmentblu [3:41 PM] 
in the plugin boot()?

spunky [3:41 PM] 
`class MyNewUser extends Backend\Models\User {}`

augmentblu [3:41 PM] 
ah right, a new model but extending the User

[3:43] 
Does the User model already extend `Authenticatable`

spunky
[3:43 PM] 
Give me a couple of days and it will (edited)

augmentblu [3:43 PM] 
sweet

LukeTowers
[4:42 PM] 
@spunky what about creating a behaviour that implements the traits and then attaching it to the backend user model?

spunky [5:02 PM] 
@LukeTowers Now you're thinking!

[5:02] 
Only issue with that is method_exists() won't work, but we can assume Laravel doesn't use it because it relies on contracts instead

augmentblu [5:29 PM] 
@spunky If I've created a model that extends `BackendAuth` already, how can I implement `use Illuminate\Foundation\Auth\User as Authenticatable; class User extends Authenticatable` this as well? Laravel Passport uses a trait `HasApiTokens` to create tokens but it's not working with my new modedl `Client::getUser()->createToken('MyApp')->accessToken`

spunky [10:29 PM] 
class User extends Backend\Models\User ~implements Authenticatable~ (edited)
[10:29] 
In fact don't even worry about the implements part, October will do it for you soon
[10:30] 
Please no more discussion on implementing until I have completed my end, it is futile otherwise

Slack chat posted above for longevity

I think that this is something that a lot of people would find very useful. In addition to Passport, Socialite and Cashier support would also add immense value to OctoberCMS in my opinion.

I'd also like to think that there would be other people (like me) who would be willing to contribute a small amount to a larger bounty to have it done given the large numbers of people who appear to be using OC these days.

Socialite is working well with OC and composer.

+1 for this issue. It would be very useful for syncing with Laravel ecosystem. As for us, we'll update our Buddies plugin according to this changes.

i can also donate something ... this is really needed feature for OC.
Currently Im using Passport on separate server instance for oAuth purpose.

Also it will be great if we can make OC easily adaptive to Laravel plugins as there are many plugins which are great to add new functionalities. I understand its still possible by implementation our own plugin and then using Laravel plugin with some modifications, but still we need to do few changes for some common task which can automated.

I guess @LukeTowers has already initiated something but its not complete yet
https://github.com/LukeTowers/oc-passport-plugin

This will come this summer as a part of the move to Laravel 5.9

This issue will be closed and archived in 3 days, as there has been no activity in the last 30 days. If this issue is still relevant or you would like to see action on it, please respond and we will get the ball rolling.

For what it's worth. My package has been doing well with working with Laravel main Auth system (along with Gate policies) and passport. So you could use that for references in transition.

https://github.com/Teranode/october-laravel-auth-bridge

This issue will be closed and archived in 3 days, as there has been no activity in the last 60 days.
If this issue is still relevant or you would like to see it actioned, please respond and we will re-open this issue.
If this issue is critical to your business, consider joining the Premium Support Program where a Service Level Agreement is offered.

I would love to use Laravel Policies and Gates functionality in October.

@Teranode is your package allow this and does not break current October version on Laravel 6?

Was this page helpful?
0 / 5 - 0 ratings