-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
will this work with OKTA? #15
Comments
I dont know. This is just a Laravel wrapper for https://github.com/onelogin/php-saml. It they do, we do. |
@VickG Yes this will work with OKTA, I have implemented this in a project quite easily |
thanks @bronxct1 for helping out! |
@bronxct1 can you share an example? |
I'll have to check if I still have an example. I left the company where I implemented this, but it was quite straightforward after following the initial set up. Basically in the Saml2Listener you will grab the saml user and log them into the Laravel application. I would be glad to help you out if you are in the Laravel slack |
Hi @bronxct1! Did you find your example? I'm working on this stuff next week an would be good to have an starting point from your experience. Best regards |
@durancu This is what I found. It should give you enough to go on. /**
* Handle the event.
*
* @param Saml2LoginEvent $event
* @return void
*/
public function handle(Saml2LoginEvent $event)
{
$saml_user = $event->getSaml2User();
$user = Contributors::where('username', '=', $saml_user->getUserId())->first();
$attributes = $user->getAttributes();
if (empty($user)) {
$user = Contributors::create([
'username' => $user->getUserId(),
'email' => $user->getUserId(),
'first_name' => $attributes['first_name'][0],
'last_name' => $attributes['last_name'][0]
]);
$user->base()->create([
'slug' => $user->full_name
]);
}
if (is_null($user->base)) {
$user->base()->create([
'slug' => $user->full_name
]);
}
if (!$user->hasRole($attributes['role'][0])) {
$role = Role::where('name', $attributes['role'][0])->first();
$user->roles()->sync([$role->id]);
}
$this->auth->login($user);
} |
Thank you @bronxct1. I will check it out! |
Sorry, it this code to replace the vendor listener handle function? I'm not sure where it goes. |
Hi all, there is another project tequilarapido/socialite-okta which might also work for Laravel / Okta. I haven't tried it yet ... I will post back when I've tried it. |
This has been implemented into the Socialite community package: |
I am trying to integrate with https://www.okta.com/
Can I use this library for that purpose?
The text was updated successfully, but these errors were encountered: