sitmpcz/oidc

There is no license information available for the latest version (v0.1) of this package.

Integration oidc client to Nette

Maintainers

Details

git.plzen.eu/devops/oidc

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

pkg:composer/sitmpcz/oidc

v0.1 2025-10-22 12:05 UTC

This package is not auto-updated.

Last update: 2025-10-23 10:19:12 UTC


README

Instalace

composer require sitmpcz/oidc

config.neon

extensions:
    openid: Sitmpcz\oidc\DI\OpenIDExtension

openid:
    issuerUrl: %env.ISSUER_URL%
    clientId: %env.CLIENT_ID%
    clientSecret: %env.CLIENT_SCRET%
    redirectUri: "http://localhost/sign/callback"

presenter

<?php

declare(strict_types=1);

namespace App\Presenters;

final class SignPresenter extends Nette\Application\UI\Presenter
{

    public function __construct(
            private OpenIDClientService $oidc
            )
    {}
    
        public function actionLogin(): void
    {
        $this->redirectUrl($this->oidc->getAuthorizationUrl());
    }
    
    public function actionCallback(): void
    {
        $userinfo = $this->oidc->handleCallback();
        $this->getUser()->login($userinfo['preferred_username']);
        $this->redirect('Homepage:');
    }