Authentication in Laravel with Keycloak: Unleash Secure SSO

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so for the next video I have already a PC and in this uh we're going to first start by linking my laral app so that I can run and test it in the browser and if I go over here and test let's also fix this as well and I'm going to do hard secure to get an htps connection and I okay now we have our login button so our first task will be we are going to get our kckl server up and running up this will take a bit of time now I on building it again if you follow me following me from the previous videos you can directly jump to Jump by using phpm do compose up you don't need to build and then we can go to the browser and typ those and we should be able to see this and and as you saw in our previous video we have specified our user name and password uh then you can use that name and password to login and over here we are going to create our server is up and our server is up and now we are going to create a new real uh let's name it demo basically R represents our application and most of you who are working with Klo already be familiar with the term realm client scope roles and authentication idty providers so these are the basic major terms and there are basically two type of clients one is a public CLI and another one is confidential client difference between them is uh when you are trying to connect to a confidential client you will need client ID and client SEC but when you are trying to connect to a public client you will only need a username and a password to connect so for Simplicity B I will name this as well confidential c n Cent and same goes for the name as well and I will enable the authentication because I am going to use thec format and I will require the implicit as well and in some cases I might use o to put as well let's hit enter and right now as you can see my base URL is htps yes and my home is basically St because I don't know what I'm going to use it for and same is for the Val URL so basically this URL represents where uh after authentication this key clock will redirect to let's say my this application is trying to authenticate after authentication on which redirect URL it will redir at this to okay and H say uh this your this not a Val okay let's leave home as it is and boom now we have our client created next thing we will need is client secret so go to the tab of credentials and copy the client secret come back to the application and go to your EnV so these are the three basic envs that you will require in order to work with keyo and after installing the package first thing you need to do is put this envs in place and then we will have to create another key for the key clo where you going to append space URL client ID client secret well this all values are going to come from your EnV and redirect so basically uh at time of authentication I will show you how this authentication works I have two methods in my controller SS controller okay let's down in first controller I redirecting my user from my larel app to KY Lo and in the second method keylo is redirecting my user to a particular Endo so that I can authenticate which user is that so to do do that I have to send a redirect URL with my request so for that you need to create a redirect URL so that this whole authentication process works now the major things that you need to do is you need to pro move to the event service provider and you will have to add this listeners and you can get this code from the official documentation so this was the package that I installed and these are the configurations that I added to my service file as well as the envs and this is a listener which you need to add and one more thing that is not mentioned in this particular doc you also need to add a provider so wait for a minute oh that one is from sorry the PHP so this is the basic provider you basically need to register the service provider and social provide manages manage service provider okay this thing is not mentioned in this stock but it is necessary to get this up and working and now I think our whole configuration is completed now if we click on login with SSO now you see like we have beened to our key close setup but right now you can see I only have a login form so let's enable a register form as well so that we can test our things out go to register go to login and enable the user registration now if I go to my website confir here again now I have a register form as well so let's start by putting values first and username can be anything and I'm using this JY as a password okay okay I think my password is bit different I will cap here and register now as you can see I have been reeded to my application on that particular redirect endpoint that I specified okay and now here you can see like I have been successfully authenticated by my pclo server and now I can either enable my uh authen apption system from my application as well like the LEL that we get by default and we can identify the user by mail if that user is present then log in that user if that user is not present create the profile basic profile of that user from the SSO values and then later on you can carry on with your own boarding process if you if you have any so this is the basic how the communication between TLO and ler works thank you for watching
Info
Channel: Thakur Coder
Views: 524
Rating: undefined out of 5
Keywords: #laravel, #keycloak, #authentication, #laravelauthentication, #keycloaklaravelintegration, #oauth, #openidconnect, #sso, #singlesignon, #phpsecurity, #apisecurity, #laravelsecurity, #phpframework, #authorization, #usermanagement, #centralizedauthentication, #iam, #opensource, #security, #devops, #php, #webdev, #devlife, #phpmagic, #keycloaklove, #laravelpower, #ditchthepasswords, #seamlesslogin, #securityfirst
Id: vQ9bLAjfz14
Channel Id: undefined
Length: 8min 59sec (539 seconds)
Published: Tue Mar 12 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.