Skip to content

daviddaytw/ally-casdoor

 
 

Repository files navigation

Adonis Ally Casdoor Driver

NPM version NPM Downloads GitHub Issues or Pull Requests

A Casdoor driver for AdonisJS Ally

Getting started

1. Install the package

Install the package from your command line.

npm install --save ally-casdoor-driver

or

yarn add ally-casdoor-driver

2. Configure the package

node ace configure ally-casdoor-driver

3. Validate environment variables

CASDOOR_DRIVER_CLIENT_ID: Env.schema.string(),
CASDOOR_DRIVER_CLIENT_SECRET: Env.schema.string(),
CASDOOR_DRIVER_CALLBACK_URL: Env.schema.string(),
CASDOOR_DRIVER_CASDOOR_ROOT: Env.schema.string(),

4. Add variables to config/ally.ts file.

const allyConfig: AllyConfig = {
  // ... other drivers
  casdoor: {
    driver: 'casdoor',
    clientId: Env.get('CASDOOR_DRIVER_CLIENT_ID'),
    clientSecret: Env.get('CASDOOR_DRIVER_CLIENT_SECRET'),
    callbackUrl: Env.get('CASDOOR_DRIVER_CALLBACK_URL'),
    casdoorRoot: Env.get('CASDOOR_DRIVER_CASDOOR_ROOT'),
  }
}

Scope

You can pass an string of scopes in the configuration. According to Casdoor's documentation, available scopes are 'openid', 'profile', 'email', 'address', 'phone'.

How it works

You can learn more about AdonisJS Ally in the documentation. And learn about the implementation in the ally-driver-boilerplate repository.

Contributing

Just submit a pull request :D