Sign inSign up

btnguyen2k/exter

By btnguyen2k

•Updated almost 4 years ago

An identity gateway that allows application to authenticate users using various identity sources.

Image
0

4.2K

btnguyen2k/exter repository overview

Exter is an identity gateway that allows application to authenticate users using various identity sources.

Supported identity sources:

  • Facebook
  • GitHub
  • Google
  • Linkedin
  • Twitter

GitHub repository: https://github.com/btnguyen2k/exter⁠

⁠Quick Start

Run Exter on localhost:8000 with Google identity source enabled:

% docker run -d --name exter -p 8000:8000 \
    -e EXTER_HOME_URL="http://localhost:8000" \
    -e GOOGLE_API_PROJECT_ID=<proj-id> \
    -e GOOGLE_API_CLIENT_ID=<client-id> \
    -e GOOGLE_API_CLIENT_SECRET=<client-secret> \
    btnguyen2k/exter

⁠Environment Variables

Common Application Configurations

Env variableDescriptionDefault value
TIMEZONETimezone for date/time-related operationsAsia/Ho_Chi_Minh
HTTP_LISTEN_ADDRListen address for REST API0.0.0.0
HTTP_LISTEN_PORTListen port for REST API8000
HTTP_HEADER_APP_ID (1)Name of HTTP header that holds "application id" info passed from clientX-App-Id
HTTP_HEADER_ACCESS_TOKEN (1)Name of HTTP header that holds "access token" info passed from clientX-Access-Token
API_MAX_REQUEST_SIZE (2)Maximum size of a HTTP request that client can send to Exter backend64kB
API_REQUEST_TIMEOUT (3)Exter backend only waits up to this amount of time to read and parse request from client10s
INIT_SYSTEM_OWNER_ID (4)User id of system "exter" app's owner

Security-related Configuration

Env variableDescriptionDefault value
HTTP_ALLOW_ORIGINS (1)CORS: value for "Access-Control-Allow-Origin" response header*
RSA_PRIVKEY_FILE (2)Path to RSA private key (PEM format)./config/keys/exter_priv.pem
RSA_PRIVKEY_PASSPHRASE (2)Pass-phrase for RSA private keyexters3cr3t
  • (1) This affects only the Exter frontend. On development env you can use the default value. On production env put your fronend domains here. Domain names are separated by spaces or commas or semi-colons. For example exteross.gpvcloud.com,exteross.mydomain.com;exteross.mydomain.net.
  • (2) On production env, do not use the default private key. Generate and use your own key.

Database Backend Configurations

Env variableDescriptionDefault value
DB_TYPEType of database backendsqlite

As of v0.6.0, Exter supports the following database backends:

⁠SQLite (DB_TYPE=sqlite)

Use SQLite⁠ as database backend. Not recommended for production use! No other configuration is needed. SQLite data is stored in the directory ./data/sqlite.

⁠Azure Cosmos DB (DB_TYPE=cosmosdb)

Use Azure Cosmos DB⁠ as database backend. Configurations for Azure Cosmos DB:

Env variableDescriptionDefault value
DB_COSMOSDB_URLConnection string to CosmosDB service
DB_COSMOSDB_MULTITENANT(boolean) If set to true, use only one CosmosDB collection to store all types of BO. Otherwise, each BO is stored in its own collectiontrue

An example of the connection string: AccountEndpoint=https://localhost:8081/;AccountKey=<cosmosdb_account_key>;Db=<cosmosdb_dbname>

⁠AWS DynamoDB (DB_TYPE=dynamodb)

Use AWS DynamoDB⁠ as database backend. Configurations for AWS DynamoDB:

Env variableDescriptionDefault value
DB_DYNAMODB_REGIONAWS Region to connect to
DB_DYNAMODB_ENDPOINTEndpoint of AWS DynamoDB service""
DB_DYNAMODB_MULTITENANT(boolean) If set to true, use only one DyanmoDB table to store all types of BO. Otherwise, each BO is stored in its own tabletrue
AWS_ACCESS_KEY_IDAWS access key, used for authentication
AWS_SECRET_ACCESS_KEYAWS secret key, used for authentication

AWS SDK automatically determines the endpoint based on the region value. Hence, DB_DYNAMODB_ENDPOINT is optional. On dev env, DB_DYNAMODB_ENDPOINT can be set to point to the local instance of AWS DynamoDB, for example http://localhost:8000.

⁠MongoDB (DB_TYPE=mongodb)

Use MongoDB⁠ as database backend. Configurations for MongoDB:

Env variableDescriptionDefault value
DB_MONGODB_DBName of MongoDB database to use
DB_MONGODB_URLConnection string to MongoDB server

An example of the connection string to connect to standalone MongoDB server: mongodb://test:test@localhost:37017/?authSource=admin.

An example of the connection string to connect to MongoDB replica cluster: mongodb://root:test@localhost:27017/admin?replicaSet=rsName&w=majority.

⁠PostgreSQL (DB_TYPE=pgsql)

Use PostgreSQL⁠ as database backend. Configurations for PostgreSQL:

Env variableDescriptionDefault value
DB_PGSQL_URLConnection string to PostgreSQL

An example of the connection string: postgres://test:test@localhost:5432/test?sslmode=disable&client_encoding=UTF-8&application_name=exter.

Identity Source Configurations

Env variableDescriptionDefault value
LOGIN_CHANNELS (1)List of enabled login channels, comma separatedfacebook,github,google,linkedin
EXTER_HOME_URL (2)Exter home url, used as "redirect_uri" for OAuth2
GOOGLE_API_PROJECT_ID (3)Google API's project-id
GOOGLE_API_CLIENT_ID (3)Google API's client-id
GOOGLE_API_CLIENT_SECRET (3)Google API's client-secret
GOOGLE_API_CLIENT_SECRET_JSON (4)Full content of client secret file
GITHUB_OAUTHAPP_CLIENT_ID (5)GitHub OAuth App's Client ID
GITHUB_OAUTHAPP_CLIENT_SECRET (5)GitHub OAuth App's Client Secret
FACEBOOK_APP_ID (6)Facebook App ID
FACEBOOK_APP_SECRET (6)Facebook App Secret
LINKEDIN_CLIENT_ID (7)LinkedIn OAuth App's Client ID
LINKEDIN_CLIENT_SECRET (7)LinkedIn OAuth App's Client Secret
LINKEDIN_REDIRECT_URI (8)Redirect uri for LinkedIn OAuth flow
  • (1) As of version 0.5.0, supported identity sources are facebook, github, google and linkedin.
  • (2) Used as redirect_uri for OAuth2 (since v0.3.0).
  • (3)(4) Create your Google API project at https://console.developers.google.com/apis/⁠ and generate client secret info on page https://console.developers.google.com/apis/credentials⁠. Either supply full content of the download client secret file in GOOGLE_API_CLIENT_SECRET_JSON environment variable; or supply project-id, client-id, client-secret and authorized domains info:
    • GOOGLE_API_PROJECT_ID: your Google API's project id
    • GOOGLE_API_CLIENT_ID: your Google API's client id
    • GOOGLE_API_CLIENT_SECRET: your Google API's client secret
  • (5) Create your GitHub OAuth app at https://github.com/settings/developers⁠
    • Set app's Authorization callback URL to <exter-url>/app/xlogin?cba=gh
    • GITHUB_OAUTHAPP_CLIENT_ID: your GitHub OAuth app's Client ID value
    • GITHUB_OAUTHAPP_CLIENT_SECRET: your GitHub OAuth app's Client Secret value
  • (6) Create your Facebook app at https://developers.facebook.com/apps/⁠
    • FACEBOOK_APP_ID: your Facebook app's App ID value
    • FACEBOOK_APP_SECRET: your Facebook app's App Secret value
  • (7)(8) Create your LinkedIn app with Sign In with LinkedIn product at https://www.linkedin.com/developers/⁠
    • Set app's Authorized redirect URL to <exter-url>/app/xlogin?cba=ln
    • LINKEDIN_CLIENT_ID: your LinkedIn OAuth app's Client ID value
    • LINKEDIN_CLIENT_SECRET: your LinkedIn OAuth app's Client Secret value
    • LINKEDIN_REDIRECT_URI: same as the Authorized redirect URL above

⁠Exter documentation

See on GitHub repository: https://github.com/btnguyen2k/exter⁠

Tag summary

Content type

Image

Digest

sha256:ce6bb7001…

Size

45.1 MB

Last updated

almost 4 years ago

docker pull btnguyen2k/exter