Skip to content
This repository has been archived by the owner on Feb 25, 2019. It is now read-only.

Config Files

Christian Smith edited this page Jun 13, 2014 · 14 revisions

Environments

Config files are named according to the NODE_ENV the server will run with. For development, the file should be named config.development.json. For production, the file should be named config.production.json.

All configuration files must define the issuer:

{
  "issuer": "http://localhost:3000"
}

Redis

Anvil Connect requires access to a Redis server and uses the default host and port for a local instance. To use a remote Redis server, provide url and auth parameters.

{
  "issuer": "http://localhost:3000",
  "redis": {
    "url": "redis://HOST:PORT",
    "auth": "PASSWORD"
  }
}

Providers

Anvil Connect uses Passport for third party authentication. Enable a provider by including configuration required by Passport.

{
  //...
  "providers": {
    "google": {
      "clientID": "<CLIENT_ID>",
      "clientSecret": "<CLIENT_SECRET>",
      "callbackURL": "https://<ISSUER>/connect/google/callback",
      "passReqToCallback": true,
      "scope": [
        "https://www.googleapis.com/auth/userinfo.profile",
        "https://www.googleapis.com/auth/userinfo.email"
      ]
    }
  }
}

Logging

Anvil Connect uses bucker for logging. Any valid configuration parameters for bucker can be included in the "logger" parameter. For example:

{
  // ...
  "logger": {
    "console": {
      "color": false
    },
    "syslog": {
      "host": "localhost",
      "port": 514,
      "facility": 18
    }
  }
}

All Parameters

issuer
REQUIRED – fully qualified base uri of the authorization server; e.g., https://accounts.anvil.io
redis
OPTIONAL – An object containing Redis server url and auth parameters. Defaults to localhost on port 6379.
client_registration
OPTIONAL – type of client registration permitted by the server. This parameter can be set to dynamic, token, or scoped. It defaults to scoped.
trusted_registration_scope
OPTIONAL – scope required to register a trusted client (defaults to realm)
providers
OPTIONAL – An object containing configuration for signing in via third party providers.
port
OPTIONAL – An integer value representing the port the server will be bound, unless a PORT environment variable is provided. Defaults to 3000.
response_types_supported
OPTIONAL – An array listing the OAuth 2.0 response_type values the server should support. Defaults to ["code", "id_token token"]
grant_types_supported
OPTIONAL – An array listing the OAuth 2.0 grant_type values the server should support. Defaults to ["authorization_code", "refresh_token"]
subject_types_supported
OPTIONAL – An array listing the Subject Identifier types the server should support. Defaults to ["public"]
id_token_signing_alg_values_supported
OPTIONAL – An array listing the JWS signing algorithms the server should support. Defaults to ["RS256"]
token_endpoint_auth_methods_supported
OPTIONAL – An array listing Client Authentication methods supported by the token endpoint. Defaults to ["client_secret_basic", "client_secret_post"]
claim_types_supported
OPTIONAL – An array listing Claim Types the server should support. Defaults to ["normal"].
claims_supported
OPTIONAL – An array listing Claim Names of the claims the server may be able to provide values for. Defaults to ["iss", "sub", "aud", "acr", "name", "given_name", "family_name", "middle_name", "nickname", "preferred_username", "profile", "picture", "website", "email", "email_verified", "zoneinfo", "locale", "joined_at", "updated_at"]
service_documentation
OPTIONAL – URL of developer documentation for this server. Defaults to https://github.com/christiansmith/anvil-connect/wiki

Example

{
  "issuer": "https://accounts.anvil.io",
  "client_registration": "dynamic",
  "providers": {
    "google": {
      "clientID": "<CLIENT_ID>",
      "clientSecret": "<CLIENT_SECRET>",
      "callbackURL": "https://accounts.anvil.io/connect/google/callback",
      "passReqToCallback": true,
      "scope": [
        "https://www.googleapis.com/auth/userinfo.profile",
        "https://www.googleapis.com/auth/userinfo.email"
      ]
    }
  },
  "redis": {
    "url": "redis://HOST:PORT",
    "auth": "PASSWORD"
  }
}