Giter VIP home page Giter VIP logo

Comments (11)

bronxct1 avatar bronxct1 commented on June 24, 2024 1

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

from laravel-saml2.

bronxct1 avatar bronxct1 commented on June 24, 2024 1

@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);
    }

from laravel-saml2.

aacotroneo avatar aacotroneo commented on June 24, 2024

I dont know. This is just a Laravel wrapper for https://github.com/onelogin/php-saml. It they do, we do.

from laravel-saml2.

bronxct1 avatar bronxct1 commented on June 24, 2024

@VickG Yes this will work with OKTA, I have implemented this in a project quite easily

from laravel-saml2.

aacotroneo avatar aacotroneo commented on June 24, 2024

thanks @bronxct1 for helping out!

from laravel-saml2.

narbehmovsesi avatar narbehmovsesi commented on June 24, 2024

@bronxct1 can you share an example?

from laravel-saml2.

durancu avatar durancu commented on June 24, 2024

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

from laravel-saml2.

durancu avatar durancu commented on June 24, 2024

Thank you @bronxct1. I will check it out!

from laravel-saml2.

durancu avatar durancu commented on June 24, 2024

Sorry, it this code to replace the vendor listener handle function? I'm not sure where it goes.

from laravel-saml2.

BrendanTWhite avatar BrendanTWhite commented on June 24, 2024

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.

from laravel-saml2.

chaseconey avatar chaseconey commented on June 24, 2024

This has been implemented into the Socialite community package:
http://socialiteproviders.github.io/providers/okta/

from laravel-saml2.

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.