{"id":14965446,"url":"https://github.com/drago-ex/keycloak","last_synced_at":"2026-02-21T06:32:40.368Z","repository":{"id":49395827,"uuid":"517600161","full_name":"drago-ex/keycloak","owner":"drago-ex","description":":key: Simple Keycloak adapter for easy integration.","archived":false,"fork":false,"pushed_at":"2025-12-30T08:03:00.000Z","size":92,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-09T02:36:51.895Z","etag":null,"topics":["keycloak","nette"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/drago-ex.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-07-25T09:28:59.000Z","updated_at":"2025-12-30T08:03:03.000Z","dependencies_parsed_at":"2024-01-12T10:15:14.009Z","dependency_job_id":"9ca3ae26-df3f-42f8-93cc-15baeda32f90","html_url":"https://github.com/drago-ex/keycloak","commit_stats":{"total_commits":79,"total_committers":1,"mean_commits":79.0,"dds":0.0,"last_synced_commit":"066b1cb8e893ff5169952781f4060eb0bb02655a"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/drago-ex/keycloak","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drago-ex%2Fkeycloak","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drago-ex%2Fkeycloak/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drago-ex%2Fkeycloak/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drago-ex%2Fkeycloak/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drago-ex","download_url":"https://codeload.github.com/drago-ex/keycloak/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drago-ex%2Fkeycloak/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29675470,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T06:23:40.028Z","status":"ssl_error","status_checked_at":"2026-02-21T06:23:39.222Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["keycloak","nette"],"created_at":"2024-09-24T13:34:46.151Z","updated_at":"2026-02-21T06:32:40.327Z","avatar_url":"https://github.com/drago-ex.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Drago Keycloak\nSimple Keycloak adapter for easy integration.\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://raw.githubusercontent.com/drago-ex/keycloak/master/license.md)\n[![PHP version](https://badge.fury.io/ph/drago-ex%2Fkeycloak.svg)](https://badge.fury.io/ph/drago-ex%2Fkeycloak)\n[![Tests](https://github.com/drago-ex/keycloak/actions/workflows/tests.yml/badge.svg)](https://github.com/drago-ex/keycloak/actions/workflows/tests.yml)\n[![Coding Style](https://github.com/drago-ex/keycloak/actions/workflows/coding-style.yml/badge.svg)](https://github.com/drago-ex/keycloak/actions/workflows/coding-style.yml)\n[![CodeFactor](https://www.codefactor.io/repository/github/drago-ex/keycloak/badge)](https://www.codefactor.io/repository/github/drago-ex/keycloak)\n[![Coverage Status](https://coveralls.io/repos/github/drago-ex/keycloak/badge.svg?branch=master)](https://coveralls.io/github/drago-ex/keycloak?branch=master)\n\n## Technology\n- PHP 8.3 or higher\n- composer\n\n## Installation\n```\ncomposer require drago-ex/keycloak\n```\n\n## Extension registration in `config.neon`\n```neon\nextensions:\n\tkeycloak: Drago\\Keycloak\\DI\\KeycloakExtension\n\n\nkeycloak:\n\n\t# https://github.com/stevenmaguire/oauth2-keycloak\n\tauthServerUrl: keycloak-server-url\n\trealm: keycloak-realm\n\tclientId: keycloak-client-id\n\tclientSecret: keycloak-client-secret\n\tredirectUri: https://example.com/callback-url\n\n\t# optional\n\t# version: 21.0.1\n\t# encryptionAlgorithm: 'RS256'\n\t# encryptionKeyPath: '../key.pem'\n\t# encryptionKey: 'contents_of_key_or_certificate'\n\n\t# https://github.com/guzzle/guzzle\n\t# guzzleHttp:\n```\n\n## Usage in Presenter\n```php\nuse Drago\\Keycloak\\KeycloakAdapter;\n\npublic function __construct(\n  private Keycloak $keycloak,\n  private KeycloakSessions $keycloakSessions,\n) {\n  parent::__construct();\n}\n\n// Simple login\nprotected function startup(): void\n{\n  parent::startup();\n  if (!$this-\u003egetUser()-\u003eisLoggedIn()) {\n    $keycloakUser = $this-\u003ekeycloakSessions-\u003egetItems()-\u003eresourceOwner;\n    $this-\u003egetUser()-\u003elogin($keycloakUser-\u003egetName(), $keycloakUser-\u003egetId());\n    $this-\u003eredirect('redirect');\n  }\n}\n\n// Custom authentication with Keycloak attributes and backlink\nprotected function startup(): void\n{\n  parent::startup();\n  if (!$this-\u003egetUser()-\u003eisLoggedIn()) {\n    $keycloakUser = $this-\u003ekeycloakSessions-\u003egetItems()-\u003eresourceOwner;\n\n    try {\n      if ($keycloakUser) {\n        $user = $this-\u003egetUser();\n\n        // Custom authenticator\n        $user-\u003esetAuthenticator($this-\u003eauthRepository);\n\n        // User login\n        $user-\u003elogin($keycloakUser-\u003egetName(), $keycloakUser-\u003egetId());\n\n        // Backlink handling\n        $this-\u003erestoreRequest($this-\u003ebacklink);\n        $this-\u003eredirect(':Backend:Admin:');\n      }\n\n    } catch (AuthenticationException $e) {\n      if ($e-\u003egetCode() === 1) {\n        $this-\u003etemplate-\u003euserLoginError = true;\n        $this-\u003egetUserLogout();\n        $redirect = $this-\u003ekeycloak-\u003egetLogoutUrl();\n        header('refresh:6; url=' . $redirect);\n      }\n    }\n  }\n}\n\n// User logout\nprivate function getUserLogout(): void\n{\n  $this-\u003egetUser()-\u003elogout();\n  $this-\u003ekeycloakSessions-\u003eremove();\n}\n```\n\n### Error message in `@layout.latte`\n```latte\n\u003cbody n:ifset=\"$userLoginError\"\u003e\n\t\u003ch1 class=\"text-danger text-center mt-5\"\u003e\n\t\t{_'The user does not have the required attributes set in keycloak.'}\n\t\u003c/h1\u003e\n\u003c/body\u003e\n\u003cbody n:if=\"$user-\u003eloggedIn\"\u003e\n\t...\n\u003c/body\u003e\n```\n\n### Items from Keycloak\n```php\n\n// Get state, accessToken, and resource owner\n$this-\u003ekeycloakSessions-\u003egetItems();\n```\n\n## User Logout Method\n```php\n$this-\u003ekeycloakSessions-\u003eremove();\n$this-\u003eredirectUrl($this-\u003ekeycloak-\u003egetLogoutUrl());\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrago-ex%2Fkeycloak","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrago-ex%2Fkeycloak","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrago-ex%2Fkeycloak/lists"}