PHP code example of stethome / ory-auth-bundle

1. Go to this page and download the library: Download stethome/ory-auth-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

stethome / ory-auth-bundle example snippets




return [
    // your other bundles above
    StethoMe\OryAuthBundle\StethoMeOryAuthBundle::class => ['all' => true],
];

class UserProvider implements UserProviderInterface
{
    /**
     * @param AppUser $user
     */
    public function refreshUser(UserInterface $user): AppUser
    {
        return $user; // noop
    }

    public function loadUserByIdentifier(string $identifier): AppUser
    {
        // identifier is Ory Kratos Identity UUID
        return new AppUser($identifier);
    }

    public function supportsClass(string $class): bool
    {
        return $class === AppUser::class;
    }
}

class AppUser implements UserInterface
{
    private string $uuid;

    public function __construct(string $identity)
    {
        $this->uuid = $identity;
    }
    
    // UserInterface methods
};