Download the PHP package peekabooauth/peekaboo-bundle without Composer
On this page you can find all versions of the php package peekabooauth/peekaboo-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download peekabooauth/peekaboo-bundle
More information about peekabooauth/peekaboo-bundle
Files in peekabooauth/peekaboo-bundle
Informations about the package peekaboo-bundle
Peekaboo Bundle
Symfony bundle for authentication integration with the Peekaboo identity server.
Requirements
- PHP 8.4+
- Symfony 7.4+ or 8.0+
Install
Add to config/bundles.php
Add to config/routes/annotations.yaml
Add to config/packages/security.yaml
Authentication Methods
The bundle supports multiple authentication methods, checked in priority order:
| Priority | Method | How to use |
|---|---|---|
| 1 | JWT Token | Authorization: Bearer <token> header, or bearer query/body parameter |
| 2 | API Key | x-api-key header, or apikey query/body parameter |
| 3 | Basic Auth | Authorization: Basic <credentials> header |
| 4 | Session | Automatic after OAuth redirect flow |
JWT Token Authentication
API Key Authentication
Basic Auth
Getting a JWT Token
Environment Variables
| Variable | Description | Default |
|---|---|---|
IDENTITY_SERVER_URL_EXTERNAL |
Public URL of identity server (for browser redirects) | https://peekabooauth.com |
IDENTITY_SERVER_URL_INTERNAL |
Internal URL of identity server (for server-to-server calls) | https://peekabooauth.com |
IDENTITY_SERVER_AUTH_PATH |
Path to authentication endpoint | /identity/auth |
IDENTITY_SERVER_LOGOUT_PATH |
Path to logout endpoint | /identity/logout |
ROUTE_AFTER_REDIRECT |
Route name to redirect after successful auth | homepage |
PEEKABOO_APPLICATION_NAME |
Your application name registered with Peekaboo | dev |
PEEKABOO_APPLICATION_SECRET |
Your application secret | (required) |
PEEKABOO_AUTOLOGIN |
Auto-login provider (see below) | (empty) |
PEEKABOO_DEV_ROLES |
Override dev user roles (comma-separated) | (empty = default roles) |
Example .env:
Local Development
To test your app without connecting to the real identity server (useful for offline development), set:
This returns a hardcoded dev user with the following properties:
- Email:
[email protected] - Name:
dev - Roles:
ROLE_ADMIN,ROLE_USER,ROLE_API,ROLE_DEV
To test with different roles, set PEEKABOO_DEV_ROLES in .env.local:
Autologin
Set PEEKABOO_AUTOLOGIN to skip the login form and authenticate automatically:
| Value | Behavior |
|---|---|
google |
Redirect directly to Google login |
facebook |
Redirect directly to Facebook login |
google_js |
Show login page, auto-click Google button |
facebook_js |
Show login page, auto-click Facebook button |
| (empty) | Show login form without autologin |
Upgrading to 1.12.0
- BREAKING:
UserDTO::getRoles()no longer addsROLE_USER. A user now holds exactly the roles Peekaboo granted for your application. Before, every authenticated identity gotROLE_USERon top: API keys and basic-auth machine users (Prometheus included), users whose only role isROLE_DISABLED, and users with no role in your application at all. SoROLE_USERinaccess_control,#[IsGranted]oris_granted()let all of them in, and arole_hierarchyentryROLE_USER: [...]handed its children to all of them. - Before upgrading, find where your app checks
ROLE_USER(access_control,#[IsGranted('ROLE_USER')],isGranted('ROLE_USER'),is_granted('ROLE_USER')in Twig,ROLE_USER: [...]inrole_hierarchy). For every role your human users hold, make sure it reachesROLE_USERthroughrole_hierarchy, e.g.ROLE_MANAGER: [ ROLE_USER ], or grantROLE_USERin Peekaboo. A page meant for anyone who can log in, with or without a role in your app, should requireIS_AUTHENTICATEDinstead ofROLE_USER. Apps that never checkROLE_USERneed no change. - The local dev user (
IDENTITY_SERVER_URL_INTERNAL=https://peekabooauth.dev) still hasROLE_USERamong its default roles; withPEEKABOO_DEV_ROLESit has exactly the roles you list. - No configuration or constructor changes.
Upgrading to 1.11.2
- Fixes every
Authorization: Bearer <jwt>request being refused with 401 (403 on the stock firewall) without ever reaching Peekaboo. The loader passed the whole header, scheme included, to HttpClient'sauth_bearer, which refuses the space and throws before sending. OAuth clients (Claude, ChatGPT, Claude Code) always send the scheme, so no OAuth connection could work. TheBearerscheme (any case) is now stripped; a bare token in the header and thebearerquery or body parameter work as before. - No configuration or constructor changes.
Upgrading to 1.11.1
- Fixes another endless redirect loop on
/peekaboo/auth. When exchanging the login code keeps failing (Peekaboo unreachable, a wrongPEEKABOO_APPLICATION_SECRET), Peekaboo's autologin answered every retry with a fresh code that failed the same way, until the browser gave up with "redirected you too many times". Now the first failure still retries once; a second failure in a row shows a plain "Login failed. Try again" page (HTTP 503) and logspeekaboo_login_failedat error level. The failure counter is the short-lived__peekaboo_auth_failurescookie (5 minutes). AuthController::auth()now takes theRequest, and its constructor gained an optionalLoggerInterface(autowired). This only matters if you construct, extend or decorate the controller yourself.
Upgrading to 1.11.0
- The bundle now reads the JWT's
expclaim. An expired token is rejected locally, without calling Peekaboo: a browser is sent to log in again at once, and Peekaboo no longer logs (and alerts on) a failedjwtlogin each time a user's token runs out. The claim is read without checking the signature, so it is only used to give up on a token, never to accept one; every other token is still verified by Peekaboo. - The
__peekaboo_tokencookie now expires together with the JWT (still at most 24 hours), and a cached user is never kept past the token's expiry (it used to live up to 10 more minutes). - No configuration or constructor changes.
Upgrading to 1.10.1
- Fixes an endless redirect loop on
/peekaboo/auth(the browser's "redirected you too many times") after the Peekaboo server rejects a stored token. A failed login now also expires the__peekaboo_tokencookie, not just the session copy, and/peekaboo/authno longer runs authentication, so a fresh login code always reaches it. Keep/peekaboo/authasPUBLIC_ACCESSinaccess_control, as the install instructions show. PeekabooAuthenticator's constructor gained an optionalTokenStorage(autowired). This only matters if you construct or decorate the authenticator yourself.
Upgrading to 1.10.0
- Requires a Peekaboo server that has
/api/token-by-code. Deploy the server first: against an older server login fails with "wrong signature". - After login the app now receives a one-time
__peekaboo_codeand exchanges it server-to-server, so the JWT no longer travels in the URL. TokenStorage's constructor gainedClient(and an optional logger). This only matters if you construct or decorate it yourself.
Development
License
GPL-3.0-only
All versions of peekaboo-bundle with dependencies
ext-json Version *
psr/log Version ^3.0
symfony/framework-bundle Version ^7.4|^8.0
symfony/http-client Version ^7.4|^8.0
symfony/http-foundation Version ^7.4|^8.0
symfony/http-kernel Version ^7.4|^8.0
symfony/routing Version ^7.4|^8.0
symfony/security-bundle Version ^7.4|^8.0
symfony/security-core Version ^7.4|^8.0
symfony/security-http Version ^7.4|^8.0
symfony/validator Version ^7.4|^8.0