Skip to content

Instantly share code, notes, and snippets.

version: "3.8"
services:
# ...
keycloak-config-cli:
image: bitnami/keycloak-config-cli:5-debian-11
environment:
KEYCLOAK_URL: http://caddy/oidc/
KEYCLOAK_USER: ${KEYCLOAK_USER:-admin}
@vincentchalamon
vincentchalamon / security.yaml
Last active August 11, 2023 11:23
Symfony Security configuration using AccessTokenAuthenticator
# api/config/packages/security.yaml
security:
firewalls:
main:
pattern: ^/
access_token:
token_handler:
oidc:
# Algorithm used to sign the JWS
algorithm: 'ES256'
@vincentchalamon
vincentchalamon / .env
Last active June 1, 2023 14:25
API Platform Keycloak Swagger
OIDC_SERVER_URL=https://localhost/oidc/realms/demo
OIDC_SWAGGER_CLIENT_ID=api-platform-swagger
@vincentchalamon
vincentchalamon / security.yaml
Created March 4, 2022 15:46
API Platform Keycloak Security
# config/packages/security.yaml
security:
enable_authenticator_manager: true
providers:
app_user_provider:
entity:
class: App\Entity\User
property: email
firewalls:
main:
@vincentchalamon
vincentchalamon / hwi_oauth.yaml
Created March 4, 2022 15:45
API Platform Keycloak hwi/oauth-bundle Configuration
# config/packages/hwi_oauth.yaml
hwi_oauth:
resource_owners:
keycloak:
type: keycloak
base_url: <keycloak_url> # should look like https://www.example.com/auth
realm: <realm_name>
client_id: <client_id>
client_secret: <client_secret>
@vincentchalamon
vincentchalamon / docker-compose.yaml
Last active August 11, 2023 10:30
API Platform Keycloak Docker Compose
# docker-compose.yaml
version: "3.8"
services:
keycloak-database:
image: postgres:15-alpine
volumes:
- keycloak_db_data:/var/lib/postgresql/data:rw
environment:
POSTGRES_DB: keycloak
import NextAuth from "next-auth";
import Providers from "next-auth/providers";
import {fetch} from "utils/dataAccess";
const options = {
providers: [
Providers.Credentials({
name: 'Credentials',
authorize: async (credentials) => {
const response = await fetch("/login_check", {
@vincentchalamon
vincentchalamon / reserved
Last active August 16, 2020 09:41
MySQL reserved words detector
#!/usr/bin/env php
<?php
/**
* Create the bin/reserved file in your project, and copy/paste this as content
* Add execution permissions: chmod +x bin/reserved
*/
set_time_limit(0);
@vincentchalamon
vincentchalamon / cypress.js
Created December 9, 2019 14:28
Cypress.io: parse iframe content
Cypress.Commands.add('iframe', {
prevSubject: 'element',
}, $iframe => {
const contentWindow = $iframe.prop('contentWindow');
return new Promise(resolve => {
if (contentWindow && contentWindow.document.readyState === 'complete') {
resolve(contentWindow);
} else {
$iframe.on('load', () => {
@vincentchalamon
vincentchalamon / cypress.js
Created December 9, 2019 14:27
Cypress.io: keep session between tests
Cypress.Cookies.defaults({
whitelist: 'PHPSESSID',
});