JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q51116F
  • License MIT

Keycloak authentication provider for AdonisJS

Package Exports

  • @dedel.alex/ally-keycloak
  • @dedel.alex/ally-keycloak/build/providers/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@dedel.alex/ally-keycloak) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Install Keycloak in Adonis

  • Run node ace configure @dedel.alex/ally-keycloak. The configure command needs the package name and not the package path.

  • Inform typescript about your driver by defining a mapping inside the contracts/ally.ts file.

    import { KeycloakDriverConfig, KeycloakDriver } from '@dedel.alex/ally-keycloak/build/standalone'
    
    declare module '@ioc:Adonis/Addons/Ally' {
      interface SocialProviders {
        keycloak: {
          config: KeycloakDriverConfig
          implementation: KeycloakDriver
        }
      }
    }
  • Follow the Adonis official process to add Social authentication: https://docs.adonisjs.com/guides/auth/social

  • Define the config inside the config/ally.ts file as follows:

    import Env from '@ioc:Adonis/Core/Env'
    
    const allyConfig = {
      /*
      |--------------------------------------------------------------------------
      | Keycloak driver
      |--------------------------------------------------------------------------
      */
      keycloak: {
        driver: 'keycloak',
        keycloakUrl: 'http://localhost:8080/realms/{realm}/protocol/openid-connect/{action}',
        realm: Env.get('KEYCLOAK_REALM'),
        clientId: Env.get('KEYCLOAK_CLIENT_ID'),
        clientSecret: Env.get('KEYCLOAK_CLIENT_SECRET'),
        callbackUrl: 'http://localhost:3333/keycloak/callback',
      },
    }

Github project

https://github.com/aDedel/adonis-ally-keycloak