定制 pagewiser/keycloak-adapter 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pagewiser/keycloak-adapter

最新稳定版本:2.1.0

Composer 安装命令:

composer require pagewiser/keycloak-adapter

包简介

Easy-to-use PHP adapter for Keycloak authentication

README 文档

README

Latest Stable Version Total Downloads License Monthly Downloads

Install

composer require ataccama/keycloak-adapter

Neon config:

parameters:
    keycloak:
        realmId: your_realm
        clientDd: your_client_id
        host: https://your.keycloak.com
        defaultRedirectUri: https://your.default.url
        api:
            username: your_username
            password: your_password
            clientId: your_api_client_id
            clientSecret: your_client_secret
            
services:
    - Ataccama\Adapters\Keycloak(%keycloak%)

Use

Create new class and extend class Ataccama\Auth, then you MUST implement all missing methods with your own logic.

Login URL: $loginUrl = $yourAuthClass->getLoginUrl()

In code use your class like this: $yourAuthClass->authorize($_GET['code'])

Example (Nette Framework):

// waiting for authorization code from Keycloak
if ($yourAuthClass->authorize($this->getParameter('code'))) {
    $this->redirectUrl($yourAuthClass->getRedirectUri());
} else {
    if (!$yourAuthClass->isAuthorized()) {
        $this->redirectUrl($yourAuthClass->getLoginUrl());
    }
}

// check if user is logged in on every page, if not redirect him to Keycloak login page
if (!$yourAuthClass->isAuthorized()) {
    $this->redirectUrl($yourAuthClass->getLoginUrl());
}

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 12
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-02