How to have two authentications in a Laravel 5 application? - php

I am developing a Laravel 5.1 application with Oauth authentication with Google using Socialite. All relevant code went into the AuthController.php and that part went smooth. Now I want to have a set of admin role users who will log in using their username and password using a login form. The username and passwords for these users will be stored in a different table admin_users. How do I proceed with this?
I have created a model AdminUser
Should I duplicate the auth.php in config with the model set to my new AdminUser class?
Should I continue using the AuthController?
Any tips would be appreciated.

Related

How to create a custom Login Form using Laravel 5.8?

I want to create a new Laravel 5.8 based application using the database of an old PHP based application.
The problem is: My previous project uses five tables to store user-related information and all of those tables are used during login (to set session data).
Those tables are user_account, user_role, user_partner_portal, user_access_control, and user_control_access_right.
The relationship between those tables are in the below images:
By default, laravel uses users table to handle authentication and I don't know how to customize Laravel login system so that I can use all of those five tables during login to authenticate a user and also store the user-related information into the session.
I am primarily using CodeIgniter for all of my projects and it is very easy to do that authentication using CodeIgniter. But I am new in Laravel, so I can't figure it out.
So my question is: Is it possible using laravel to design such an authentication system? If yes then how?
TIA
So laravel uses LoginController class for the login. Inside there you are going to find the function authenticate.
Laravel put's the predefined logic there but if you want to make it really custom like update all your tables etc etc you are free to do it.
You can even create your own class and change the login route to point to your own controller. Basically you can do anything you like.

Developing more than one user accounts in laravel 5.2

Note: There is no code to show or prove it, we just need a methodology to solve the problem before implementing the code to our code base.
We have more than one user for our fashion web (laravel app)
Guest (does not matter to this issue)
User (Fashion lovers/Customers/Clients)
Tailors (Fashion designers new/existing accounts in the platform)
The users(customers) can login and register to their application without no problem but our problem is how can we filter the two users(customers/tailors) such that when a user (tailor) logins to www.app.dev/tailor#dashboard (without access) it redirects to (www.app.dev/login) and when the user is a tailor it takes the user to tailors login page instead the user (customers) login, Do you understand me??
check for following stackoverflow questions
Can anyone explain Laravel 5.2 Multi Auth with example
How to use multi Auth in laravel 5.2
Multiple auth user types in Laravel 5

Login/Register without Laravel's Authentication Services

I am new to Laravel and felt that the Authorization system provided out of the box is difficult to customize and implement.
Is it a good idea to implement the Login/Register functionality from scratch using controllers and middlewares in laravel?
For example, a middleware 'webAuth' will keep a check on whether the user is logged in just by checking request->session()->has('userId').
The login controller will take email and password and search for user the user in database using email, get the password and Hash::check() it with the one provided by user during login. If the password check succeeds, the user will get be authenticated by setting $request->session()->put('userId', $user->userId).
Finally, a register controller can create a new user by taking in the details such as name, email, password, dob etc. using a form and creating a new user model. The user can then be logged in using the same method as mentioned above.
The login and register controllers will of course use Validator and may also redirect user appropriately.

How to use Auth::check() for Users who logged in via Hybridauth Package in Laravel

I managed to work hybridauth package in Laravel 4.1 and I am able to get twitter info of a user.
I add a user row to the users table for the first time users. However, this row doesn't have email and password values which are used in Auth::attemp() function to authenticate non-social users.
My question is that, should I use Auth::attemp() function for social users? If not, how can I make valid Auth::check() functions in controller and blade files?

Single Sign On between Yii and Moodle two php application

I have implement SOS concept between two php application. it application it available different domain like one is www.example.com and another is www.test.com.
My required following condition.
1.When user is login any appplication to login this user with check user name and password into mysql database table
2.After login any application username and password is not required/reenter user can directly login this application similar to Google.
3.When user logout at time both application can be logout.
-->my first application can be created Yii framework and another is moodle
please give idea to implement this concept in my both application

Categories